Juce apps not showing up on some older devices

I was testing my app with an older Nexus 5 today and found that with API 23 the app never loads and the only thing I get is an empty application frame with the titlebar.

I did a little digging with breakpoints in the cpp code and it seems it never initialises the the Juce app.

Android studio gives the following error:
Cannot resolve corresponding JNI function Java_com_rmsl_juce_Java_initialiseJUCE. Could not find an existing file with JNI definitions in it. Please add a file with JNI definitions to the project in order to get suggestions.

Update: now the error went away after saving and opening from Projucer. Still no content on an app that works perfectly on iOS, Windows and Mac.

Any tips on what I should try to make it work?

Thanks.

@rmri
I’m facing the same issue with my application. However, it’s working fine (well, mostly, I do have a few bugs related to it, I suppose) on many Android phones. It just doesn’t work on a few specific ones. I’m in the same boat as you with the “Cannot resolve corresponding JNI function” errors like Java_com_rmsl_juce_Java_initialiseJUCE, as well as Java_com_rmsl_juce_JuceActivity_appNewIntent, Java_com_rmsl_juce_JuceActivity_appOnResume, Java_com_rmsl_juce_JuceSharingContentProvider_contentSharerQuery, Java_com_rmsl_juce_JuceSharingContentProvider_contentSharerOpenFile, and Java_com_rmsl_juce_JuceSharingContentProvider_contentSharerGetStreamTypes.

How can we go about resolving this? (No issues on iOS, and my own Android phone works perfectly fine.)

What’s even more puzzling is that my app compiles perfectly in Android Studio. In fact, my app is already on the Play Store… I didn’t realize it right away; it was the few Firebase bugs (Crashlytics) that made me realize it.

The Nexus 5 uses the ARMv7 instruction set. It might be worth checking that you’re definitely building for the correct architecture.

@reuk
I haven’t changed the “architecture” line in Projucer (Android). And it doesn’t seem to be directly related to Android Studio’s inability to resolve the mentioned JNI functions, does it?

When are you seeing the “cannot resolve corresponding function” diagnostic? In your crash logs, or just in the IDE?

Assuming the diagnostic is in the crash log, my guess was that the functions might not be found on some devices because the shared library that contains them can’t be loaded for some reason on those devices. Then, it makes sense to check any unusual things that those devices have in common. The Nexus 5 differs from the android emulator and “modern” devices that you might use for testing in its architecture, so that seemed like a reasonable thing to check first.

If the diagnostic is just shown by Android Studio, then there’s a good chance it’s completely unrelated to the crash. You’d need to carefully inspect the crash logs to determine the cause of the problem.

Thank you so much @reuk for your prompt responses. I’m observing these messages exclusively within the IDE. However, given the presence of crashes in Firebase Crashlytics that appear to be correlated with JNI functions, I presumed there might be a connection to these errors within Android Studio, I’m sorry.

I’d like to share a subset of Crashlytics crash reports, which have been reported by users of my application, in the hopes that you might be able to offer some guidance. Thanks :

  1. ANR, com.rmsl.juce.JuceInvocationHandler.dispatchInvoke (main native)
    (Poco M2 Pro, Realme 10 Pro+, Realme 8, V27, CPH2001, RMX2040, Vivo 1907_19, Tecno Spark 8P, Moto G Play, etc…)

main (native):tid=1 systid=17553
#00 pc 0x88270 libc.so (syscall + 32) (BuildId: 2f84be24a19d511a358a9050af5b3974)
#01 pc 0x8cb3c libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*) + 148) (BuildId: 2f84be24a19d511a358a9050af5b3974)
#02 pc 0xf0020 libc.so (pthread_cond_wait + 84) (BuildId: 2f84be24a19d511a358a9050af5b3974)
#03 pc 0xad45ac split_config.arm64_v8a.apk (std::__ndk1::condition_variable::wait(std::__ndk1::unique_lockstd::__ndk1::mutex&) [__threading_support:295]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#04 pc 0x746ee0 split_config.arm64_v8a.apk (juce::WaitableEvent::wait(int) const [__mutex_base:365]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#05 pc 0x824b14 split_config.arm64_v8a.apk (juce::AndroidMessageQueue::run() [juce_android_Messaging.cpp:104]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#06 pc 0x824a54 split_config.arm64_v8a.apk (juce::Android::Runnable::invoke(_jobject*, _jobject*, _jobjectArray*) [juce_android_Messaging.cpp:42]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#07 pc 0x461754 libart.so (art_quick_generic_jni_trampoline + 148) (BuildId: 6fc1c03912861b04885c9f2953121b6b)
#08 pc 0x20b02c libart.so (nterp_helper + 7468) (BuildId: 6fc1c03912861b04885c9f2953121b6b)
at com.rmsl.juce.JuceInvocationHandler.dispatchInvoke(Native method)
at com.rmsl.juce.JuceInvocationHandler.invoke(JuceInvocationHandler.java:28)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at java.lang.Runnable.run(Runnable.java)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8319)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1038)

  1. Fatal Exception (com.rmsl.juce.Java.): java.lang.UnsatisfiedLinkError (<1 seconde, Immediately after the launch of my application)
    (PIxel 5, Redmi K50i, MGA-LX9, Galaxy S20FE, Realme C21-Y, DCO-LX9, etc…)

Fatal Exception: java.lang.UnsatisfiedLinkError: dlopen failed: library “libjuce_jni.so” not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
at java.lang.System.loadLibrary(System.java:1664)
at com.rmsl.juce.Java.(Java.java:31)
at com.rmsl.juce.Java.initialiseJUCE(Java.java)
at com.rmsl.juce.JuceApp.onCreate(JuceApp.java:35)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1198)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7050)
at android.app.ActivityThread.access$1500(ActivityThread.java:263)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2032)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:268)
at android.app.ActivityThread.main(ActivityThread.java:8016)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:627)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:997)

  1. SIGABRT 0x0000000000000000
    (Galaxy A53 5G, Tecno pova2, Pixel 6a, P20 Pro, Redmi Note 10Pro, Poco F5, Galaxy A22G, Nokia 5.3, etc…)

Crashed: Thread: SIGABRT 0x0000000000000000
#00 pc 0x51698 libc.so (BuildId: ad0153976e613ee91bf72d56f38cfbaa)
#01 pc 0x51668 libc.so (BuildId: ad0153976e613ee91bf72d56f38cfbaa)
#02 pc 0x6f331c libart.so (BuildId: 6fc1c03912861b04885c9f2953121b6b)
#03 pc 0x16ea8 libbase.so (BuildId: 420d56eac27a210c92900f3ddb760c86)
#04 pc 0x16450 libbase.so (BuildId: 420d56eac27a210c92900f3ddb760c86)
#05 pc 0x465ad0 libart.so (BuildId: 6fc1c03912861b04885c9f2953121b6b)
#06 pc 0x5ed39c libart.so (BuildId: 6fc1c03912861b04885c9f2953121b6b)
#07 pc 0x6732dc libjuce_jni.so (_JNIEnv::CallVoidMethod(_jobject*, _jmethodID*, …) [jni.h:632]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#08 pc 0x9bdf40 libjuce_jni.so (void juce::AccessibilityNativeHandle::sendAccessibilityEventExtendedImpl<juce::AccessibilityNativeHandle::sendAccessibilityEventImpl(juce::AccessibilityHandler const&, int, int)::‘lambda’(auto)>(juce::AccessibilityHandler const&, int, auto&&) [juce_android_Accessibility.cpp:773]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#09 pc 0x8c1828 libjuce_jni.so (juce::AccessibilityHandler::takeFocus() [juce_android_Accessibility.cpp:794]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#10 pc 0x8c15f4 libjuce_jni.so (juce::AccessibilityHandler::grabFocusInternal(bool) [juce_AccessibilityHandler.cpp:293]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#11 pc 0x8ce480 libjuce_jni.so (juce::Component::takeKeyboardFocus(juce::Component::FocusChangeType) [juce_AccessibilityHandler.cpp:280]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#12 pc 0x8cb26c libjuce_jni.so (juce::Component::grabKeyboardFocusInternal(juce::Component::FocusChangeType, bool) [juce_Component.cpp:2956]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#13 pc 0x8cb2c4 libjuce_jni.so (juce::Component::grabKeyboardFocusInternal(juce::Component::FocusChangeType, bool) [juce_Component.cpp:2967]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#14 pc 0x8c258c libjuce_jni.so (juce::Component::setVisible(bool) [juce_Component.cpp:2984]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#15 pc 0x56ffac libjuce_jni.so (WindowUser::paint(juce::Graphics&) [Interface.cpp:1361]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#16 pc 0x8c8d78 libjuce_jni.so (juce::Component::paintComponentAndChildren(juce::Graphics&) [juce_Component.cpp:2010]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#17 pc 0x8c8c54 libjuce_jni.so (juce::Component::paintEntireComponent(juce::Graphics&, bool) [juce_Component.cpp:2107]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#18 pc 0x8c8fe0 libjuce_jni.so (juce::Component::paintComponentAndChildren(juce::Graphics&) [juce_Component.cpp:1994]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#19 pc 0x8c8c54 libjuce_jni.so (juce::Component::paintEntireComponent(juce::Graphics&, bool) [juce_Component.cpp:2107]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#20 pc 0xa3a70c libjuce_jni.so (juce::OpenGLContext::CachedImage::paintComponent(juce::OpenGLContext::CachedImage::AreaAndScale const&) [juce_OpenGLContext.cpp:571]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#21 pc 0xa39cb0 libjuce_jni.so (juce::OpenGLContext::CachedImage::renderFrame(juce::MessageManager::Lock&) [juce_OpenGLContext.cpp:405]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#22 pc 0xa399d0 libjuce_jni.so (juce::OpenGLContext::CachedImage::RenderThread::renderAll() [juce_OpenGLContext.cpp:835]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#23 pc 0xa398d4 libjuce_jni.so (juce::OpenGLContext::CachedImage::RenderThread::thread::‘lambda’()::operator()() const [juce_OpenGLContext.cpp:925]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#24 pc 0xa397e4 libjuce_jni.so (void* std::__ndk1::__thread_proxy<std::__ndk1::tuple<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_deletestd::__ndk1::__thread_struct >, juce::OpenGLContext::CachedImage::RenderThread::thread::‘lambda’()> >(std::__ndk1::tuple<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_deletestd::__ndk1::__thread_struct >, juce::OpenGLContext::CachedImage::RenderThread::thread::‘lambda’()>) [type_traits:3501]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#25 pc 0xb508c libc.so (BuildId: ad0153976e613ee91bf72d56f38cfbaa)
#26 pc 0x52f9c libc.so (BuildId: ad0153976e613ee91bf72d56f38cfbaa)

  1. wait?
    (P20 Pro, Galaxy S9, Huawei P30 Lite, F9, Moto G73 5G, Galaxy A21s, Vivo 1904, etc…)

SIGABRT 0x0000000000000000
Thread:
#00 pc 0x7f33c libc.so (BuildId: 5d7c94b262814ba928c49360adfa7f36)
#01 pc 0x829a4 libc.so (BuildId: 5d7c94b262814ba928c49360adfa7f36)
#02 pc 0xe186c libc.so (BuildId: 5d7c94b262814ba928c49360adfa7f36)
#03 pc 0xad45ac libjuce_jni.so (std::__ndk1::condition_variable::wait(std::__ndk1::unique_lockstd::__ndk1::mutex&) [__threading_support:295]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#04 pc 0x746ee0 libjuce_jni.so (juce::WaitableEvent::wait(int) const [__mutex_base:365]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#05 pc 0x824b14 libjuce_jni.so (juce::AndroidMessageQueue::run() [juce_android_Messaging.cpp:104]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#06 pc 0x824a54 libjuce_jni.so (juce::Android::Runnable::invoke(_jobject*, _jobject*, _jobjectArray*) [juce_android_Messaging.cpp:42]) (BuildId: 4d524f89d4f32376777f66ff27e90fa6a9624df7)
#07 pc 0x9ce6cc08
#08 pc 0x7d1ee6f47c

  1. com.rmsl.juce.ComponentPeerView.handleMouseUp

main (runnable):tid=1 systid=28542
at android.util.Log$ImmediateLogWriter.write(Log.java:513)
at java.io.PrintWriter.write(PrintWriter.java:507)
at com.android.internal.util.LineBreakBufferedWriter.writeBuffer(LineBreakBufferedWriter.java:290)
at com.android.internal.util.LineBreakBufferedWriter.flush(LineBreakBufferedWriter.java:92)
at android.util.Log.printlns(Log.java:468)
at android.util.Log.e(Log.java:266)
at android.view.accessibility.AccessibilityManager.sendAccessibilityEvent(AccessibilityManager.java:706)
at android.view.ViewRootImpl.requestSendAccessibilityEvent(ViewRootImpl.java:9976)
at android.view.ViewGroup.requestSendAccessibilityEvent(ViewGroup.java:1107)
at com.rmsl.juce.ComponentPeerView.handleMouseUp(Native method)
at com.rmsl.juce.ComponentPeerView.onTouchEvent(ComponentPeerView.java:199)
at android.view.View.dispatchTouchEvent(View.java:15069)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3196)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2838)
at android.view.View.dispatchPointerEvent(View.java:15333)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6945)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6726)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6178)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6235)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6201)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6366)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6209)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6423)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6182)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:6235)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:6201)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:6209)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:6182)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:9382)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:9333)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:9272)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9514)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:267)
at android.os.MessageQueue.nativePollOnce(Native method)
at android.os.MessageQueue.next(MessageQueue.java:335)
at android.os.Looper.loopOnce(Looper.java:164)
at android.os.Looper.loop(Looper.java:291)
at android.app.ActivityThread.main(ActivityThread.java:8129)
at java.lang.reflect.Method.invoke(Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1019)