When trying to navigate to a website by calling URL::launchInDefaultBrowser on Android (which subsequently calls Process::OpenDocument), this call crashes the app.
Now, I’m not sure if something like app signing is at play… so I’m wondering if anybody else is seeing the same thing on their end.
tjl
April 27, 2026, 6:43pm
2
I am seeing this using JUCE 8. Has anyone figured out what the issue is?
No idea. The support for Android has been meagre and anemic at best.
tjl
May 1, 2026, 1:18pm
4
I believe getCurrentActivity is returning nullptr.
Here’s a stack trace from Google Play Console:
JNI DETECTED ERROR IN APPLICATION: obj == null
_JNIEnv::CallVoidMethod(_jobject*, _jmethodID*, …)
sdk/ndk/28.2.13676358/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/jni.h:631:9
juce::Process::openDocument(juce::String const&, juce::String const&)
modules/juce_core/native/juce_Files_android.cpp:903:10
juce::URL::launchInDefaultBrowser() const
modules/juce_core/network/juce_URL.cpp:1024:12
juce::Button::sendClickMessage(juce::ModifierKeys const&)
Here’s my version of juce’s Process::openDocument:
895 JUCE_API bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String&)
896 {
897 URL targetURL (fileName);
898 auto* env = getEnv();
899
900 const LocalRef action (javaString (“android.intent.action.VIEW”));
901 LocalRef intent (env->NewObject (AndroidIntent, AndroidIntent.constructWithUri, action.get(), urlToUri (targetURL).get()));
902
903 env->CallVoidMethod (getCurrentActivity(), AndroidContext.startActivity, intent.get());
904 return true;
905 }
Seems this is related to another issue with the current activity:
I’m having an issue requesting audio recording permissions where FragmentOverlay::open() gets invoked, and the call on CallObjectMethod has a null argument from getCurrentActivity().get(). My code is not managed by projucer, but I’m attaching the thread and calling initialiseJUCE() correctly. What could cause this call to be null?
Could be related to permissions, could be an API thing, it’s hard to say. You’ll probably get more information in the logs via Logcat.