Hi, I didn't look through your logs in detail, but the issue sounds like it might be related to https://bugreports.qt.io/browse/QTBUG-68813 - I needed the workaround from the end of the bug's description in order to get my JNI calls working again. My code also works with Qt 5.9 and doesn't work with 5.11.2, just like in this report.
The workaround might however have some bad side effects, as mentioned by Bogdan Vatra (the Qt for Android maintainer) in one of the comments - the issue is unresolved ... Best regards Markus Am Do., 1. Nov. 2018 um 20:31 Uhr schrieb coroberti . <corobe...@gmail.com>: > Hi, > I was trying to build my Qt widget app that is working on Android > since Qt 5.3, later 5.7 and 5.9 > using downloaded offline Qt 5.11.2. > > Using Qt JNI seems to be working properly, like: > RequestPermissions = > > QAndroidJniObject("com/domain/myapp/permissions/RequestPermissions", > "(Landroid/app/Activity;)V", > > QtAndroid::androidActivity().object<jobject>() > ); > > // Checking for errors in the JNI > QAndroidJniEnvironment env; > if (env->ExceptionCheck()) { > // Handle exception here. > env->ExceptionClear(); > } > > Unfortunately, the very first non-Qt JNI in my app crashes it. > JNIEnv* env; > if (g_javaVM->AttachCurrentThread(&env, NULL)<0) > { > return false; > } > jboolean res = env->CallStaticBooleanMethod(s_sharingClassID, > s_sharingMyFuncMethodID); > g_javaVM->DetachCurrentThread(); > > This is not something specific JNI, but really the first one non-Qt > JNI crashes it. > > > Is there any initialization or some magic in the new Qt JNI that could > impact > non-Qt JNI? > > Should I detach thread manually after Qt JNI? > > > rt : art/runtime/runtime.cc:1537] > > Thread[11,tid=6741,Native,Thread*=0xe4ab5f00,peer=0x12c11ee0,"qtMainLoopThread"] > attempting to detach while still running code > F art : art/runtime/runtime.cc:424] Runtime aborting... > F art : art/runtime/runtime.cc:424] Aborting thread: > F art : art/runtime/runtime.cc:424] "qtMainLoopThread" prio=5 tid=11 Native > F art : art/runtime/runtime.cc:424] | group="" sCount=0 dsCount=0 > obj=0x12c11ee0 self=0xe4ab5f00 > F art : art/runtime/runtime.cc:424] | sysTid=6741 nice=0 cgrp=default > sched=0/0 handle=0xf07bc920 > F art : art/runtime/runtime.cc:424] | state=R schedstat=( 78120491 > 95764296 62 ) utm=6 stm=1 core=0 HZ=100 > F art : art/runtime/runtime.cc:424] | stack=0xf06ba000-0xf06bc000 > stackSize=1038KB > F art : art/runtime/runtime.cc:424] | held mutexes= "abort lock" > > F art : art/runtime/runtime.cc:424] native: #00 pc 0058848e > /system/lib/libart.so > > (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+238) > F art : art/runtime/runtime.cc:424] native: #01 pc 00553ebe > /system/lib/libart.so > > (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+526) > F art : art/runtime/runtime.cc:424] native: #02 pc 00550ebb > /system/lib/libart.so > > (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+75) > F art : art/runtime/runtime.cc:424] native: #03 pc 0053c8d3 > /system/lib/libart.so > > (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+67) > F art : art/runtime/runtime.cc:424] native: #04 pc 0053c6a7 > /system/lib/libart.so > > (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+615) > F art : art/runtime/runtime.cc:424] native: #05 pc 0052cc0b > /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+155) > F art : art/runtime/runtime.cc:424] native: #06 pc 0011def3 > /system/lib/libart.so (_ZN3art10LogMessageD1Ev+1939) > F art : art/runtime/runtime.cc:424] native: #07 pc 0052c679 > /system/lib/libart.so (_ZN3art7Runtime19DetachCurrentThreadEv+377) > F art : art/runtime/runtime.cc:424] native: #08 pc 003a1d85 > /system/lib/libart.so (_ZN3art3JII19DetachCurrentThreadEP7_JavaVM+69) > F art : art/runtime/runtime.cc:424] native: #09 pc 0013572d > /data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so > (_ZN14AndroidSharing12isMyFuncEv+109) > F art : art/runtime/runtime.cc:424] native: #10 pc 00099f30 > /data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so > (_ZN12GPreferences19check_if_myfuncEv+48) > F art : art/runtime/runtime.cc:424] native: #11 pc 00074d09 > /data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so > (_ZN8TextEditC1EP7QWidget+2377) > F art : art/runtime/runtime.cc:424] native: #12 pc 00051b7b > /data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so > (main+747) > F art : art/runtime/runtime.cc:424] at > org.qtproject.qt5.android.QtNative$6.run(QtNative.java:359) > F art : art/runtime/runtime.cc:424] at > org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61) > F art : art/runtime/runtime.cc:424] at > java.lang.Thread.run(Thread.java:761) > F art : art/runtime/runtime.cc:424] Dumping all threads without > appropriate locks held: thread list lock mutator lock > F art : art/runtime/runtime.cc:424] All threads: > > F art : art/runtime/runtime.cc:424] DALVIK THREADS (14): > > F art : art/runtime/runtime.cc:424] "qtMainLoopThread" prio=5 tid=11 > Runnable > F art : art/runtime/runtime.cc:424] | sysTid=6741 nice=0 cgrp=default > sched=0/0 handle=0xf07bc920 > F art : art/runtime/runtime.cc:424] | state=R schedstat=( 92273427 > 100558772 70 ) utm=6 stm=2 core=0 HZ=100 > F art : art/runtime/runtime.cc:424] | stack=0xf06ba000-0xf06bc000 > stackSize=1038KB > F art : art/runtime/runtime.cc:424] | held mutexes= "abort lock" > "mutator lock"(shared held) > > F art : art/runtime/runtime.cc:424] native: #00 pc 0058848e > /system/lib/libart.so > > (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+238) > F art : art/runtime/runtime.cc:424] native: #01 pc 00553ebe > /system/lib/libart.so > > (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+526) > F art : art/runtime/runtime.cc:424] native: #02 pc 00550ebb > /system/lib/libart.so > > (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+75) > F art : art/runtime/runtime.cc:424] native: #03 pc 00570d44 > /system/lib/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+1092) > F art : art/runtime/runtime.cc:424] native: #04 pc 00566d8e > /system/lib/libart.so > (_ZN3art10ThreadList13RunCheckpointEPNS_7ClosureE+590) > F art : art/runtime/runtime.cc:424] native: #05 pc 00566902 > /system/lib/libart.so > > (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEb+962) > F art : art/runtime/runtime.cc:424] native: #06 pc 0053cb28 > /system/lib/libart.so > > (_ZNK3art10AbortState14DumpAllThreadsERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+424) > F art : art/runtime/runtime.cc:424] native: #07 pc 0053c876 > /system/lib/libart.so > > (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+1078) > F art : art/runtime/runtime.cc:424] native: #08 pc 0052cc0b > /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+155) > F art : art/runtime/runtime.cc:424] native: #09 pc 0011def3 > /system/lib/libart.so (_ZN3art10LogMessageD1Ev+1939) > F art : art/runtime/runtime.cc:424] native: #10 pc 0052c679 > /system/lib/libart.so (_ZN3art7Runtime19DetachCurrentThreadEv+377) > F art : art/runtime/runtime.cc:424] native: #11 pc 003a1d85 > /system/lib/libart.so (_ZN3art3JII19DetachCurrentThreadEP7_JavaVM+69) > F art : art/runtime/runtime.cc:424] native: #12 pc 0013572d > /data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so > (_ZN14AndroidSharing12isMyFuncEv+109) > F art : art/runtime/runtime.cc:424] native: #13 pc 00099f30 > /data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so > (_ZN12GPreferences19check_if_myfuncEv+48) > F art : art/runtime/runtime.cc:424] native: #14 pc 00074d09 > /data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so > (_ZN8TextEditC1EP7QWidget+2377) > F art : art/runtime/runtime.cc:424] native: #15 pc 00051b7b > /data/app/com.domain.myapplication-2/lib/x86/libMyapplication.so > (main+747) > F art : art/runtime/runtime.cc:424] native: #16 pc 0001ca00 > > /data/data/com.domain.myapplication/qt-reserved-files/plugins/platforms/android/libqtforandroid.so > (???) > F art : art/runtime/runtime.cc:424] native: #17 pc 0003bef6 > /data/app/com.domain.myapplication-2/oat/x86/base.odex > (Java_org_qtproject_qt5_android_QtNative_startQtApplication__+98) > F art : art/runtime/runtime.cc:424] at > org.qtproject.qt5.android.QtNative.startQtApplication(Native method) > F art : art/runtime/runtime.cc:424] at > org.qtproject.qt5.android.QtNative$6.run(QtNative.java:359) > F art : art/runtime/runtime.cc:424] at > org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61) > F art : art/runtime/runtime.cc:424] at > java.lang.Thread.run(Thread.java:761) > F art : art/runtime/runtime.cc:424] > F art : art/runtime/runtime.cc:424] "Jit thread pool worker thread 0" > prio=5 tid=2 Runnable (still starting up) > F art : art/runtime/runtime.cc:424] | group="" sCount=0 dsCount=0 > obj=0x0 self=0xe9c08000 > > > Thanks in advance > > Kind regards, > Robert > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest