Crash on Android 10

Hi all,

I have an application which was running fine on Android 9 (and previous versions)
But it crash on startup with Android 10 (API 29).
It seems that API 29 introduced a lot of methods in ActivityLifecycleCallbacks and that ActivityLifecycleCallbacks (in JNIHelpers.cpp) needs a bit of udpate to take that into account.

I managed to make my application work by changing the last line (the methodName.startsWith("onActivity") ? nullptr : part ) (which is a ugly hack I confess)

jobject ActivityLifecycleCallbacks::invoke (jobject proxy, jobject method, jobjectArray args)
auto* env = getEnv();

auto methodName = juceString ((jstring) env->CallObjectMethod (method, JavaMethod.getName));

auto activity = env->GetArrayLength (args) > 0 ? env->GetObjectArrayElement (args, 0) : (jobject) nullptr;
auto bundle   = env->GetArrayLength (args) > 1 ? env->GetObjectArrayElement (args, 1) : (jobject) nullptr;

if      (methodName == "onActivityCreated")             { onActivityCreated (activity, bundle); return nullptr; }
else if (methodName == "onActivityDestroyed")           { onActivityDestroyed (activity); return nullptr; }
else if (methodName == "onActivityPaused")              { onActivityPaused (activity); return nullptr; }
else if (methodName == "onActivityResumed")             { onActivityResumed (activity); return nullptr; }
else if (methodName == "onActivitySaveInstanceState")   { onActivitySaveInstanceState (activity, bundle); return nullptr; }
else if (methodName == "onActivityStarted")             { onActivityStarted (activity); return nullptr; }
else if (methodName == "onActivityStopped")             { onActivityStopped (activity); return nullptr; }

return methodName.startsWith("onActivity") ? nullptr : AndroidInterfaceImplementer::invoke (proxy, method, args);

Did I miss something or does Juce need a bit of update for Android 10 ?

Thanks for your help

I just had a look at the “develop” branch and the bug seems to be fixed…
Any idea on when it will be available in the stable branch ?

Thanks a lot

About two weeks or so.

1 Like

Any news on a release date ?

If it is not coming soon, I will fork and cherry pick the commit until the release date, but I would prefer not to.


Any news?

The fix is in Juce 5.4.5 which was released in October…

Thank you!