From 30359a689ff6af67d507ed1887503b1d57bad2d1 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 1 Jun 2021 20:11:59 +0200 Subject: [PATCH] Android: document workaround to use JNI on native thread (see bug #4406) --- docs/README-android.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/README-android.md b/docs/README-android.md index 8b626f6b1..9ad8627b3 100644 --- a/docs/README-android.md +++ b/docs/README-android.md @@ -243,6 +243,16 @@ your thread automatically anyway (when you make an SDL call), but it'll never detach it. +If you ever want to use JNI in a native thread (created by "SDL_CreateThread()"), +it won't be able to find your java class and method because of the java class loader +which is different for native threads, than for java threads (eg your "main()"). + +the work-around is to find class/method, in you "main()" thread, and to use them +in your native thread. + +see: +https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class + Using STL ================================================================================