Android crash if JUCE_PUSH_NOTIFICATIONS_ACTIVITY not defined

Hi Juce devs,

There is a bug in the Android implementation you might want to fix.

When this is called in the Android lifecycle:

    protected void onNewIntent (Intent intent)

The code calls

appNewIntent (intent);

Which is declared as

    private native void appNewIntent (Intent intent);

However, that native method is implemented only if JUCE_PUSH_NOTIFICATIONS_ACTIVITY is defined.

If you don’t have JUCE_PUSH_NOTIFICATIONS_ACTIVITY defined, then the app will crash.

Thanks in advance,

Pete

The JuceActivity will only be used if push notifications are enabled, otherwise we just used the default android.app.Activity -

What does your project setup look like? Have you re-saved it with a version of the Projucer containing this change?

Hi Ed,

Thanks for that. The thing is, I’ve got JuceActivity in my project, but no other references to it.
However, the crash reporting code I’m using (AppCenter, as it happens) shows that onNewIntent in JuceActivity is called periodically, causing the crash.

JUCE_PUSH_NOTIFICATIONS_ACTIVITY isn’t defined.

My work-around is just to replace appNewIntent(intent) with a call to finish()

I’ve not been able to figure-out what provokes this code to be called in the first place. All rather puzzling! But thank goodness for crash reporting software.

Best wishes,

Pete

juceActivity.java, line -2
java.lang.UnsatisfiedLinkError: No implementation found for void com.rmsl.juce.JuceActivity.appNewIntent(android.content.Intent) (tried Java_com_rmsl_juce_JuceActivity_appNewIntent and Java_com_rmsl_juce_JuceActivity_appNewIntent__Landroid_content_Intent_2)

com.rmsl.juce.JuceActivity.appNewIntent JuceActivity.java
com.rmsl.juce.JuceActivity.onNewIntent JuceActivity.java:43
android.app.Activity.performNewIntent Activity.java:8052
android.app.Instrumentation.callActivityOnNewIntent Instrumentation.java:1410
android.app.Instrumentation.callActivityOnNewIntent Instrumentation.java:1423
android.app.ActivityThread.deliverNewIntents ActivityThread.java:3720
android.app.ActivityThread.handleNewIntent ActivityThread.java:3732
android.app.servertransaction.NewIntentItem.execute NewIntentItem.java:53
android.app.servertransaction.TransactionExecutor.executeCallbacks TransactionExecutor.java:135
android.app.servertransaction.TransactionExecutor.execute TransactionExecutor.java:95
android.app.ActivityThread$H.handleMessage ActivityThread.java:2121
android.os.Handler.dispatchMessage Handler.java:106
android.os.Looper.loop Looper.java:248
android.app.ActivityThread.main ActivityThread.java:7787
java.lang.reflect.Method.invoke Method.java
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run RuntimeInit.java:592
com.android.internal.os.ZygoteInit.main ZygoteInit.java:952

What does the activity element of your project’s AndroidManifest.xml file look like? For a default JUCE Android project without push notifications enabled the android:name attribute should be “android.app.Activity”.

1 Like

Hi Ed,

That must explain it - for some reason, I had this set as follows:

<activity
android:name=“com.rmsl.juce.JuceActivity”

I’ll change it as you describe - I’m sure it’ll now work as intended!

Thanks very much for taking the trouble to respond, and with best wishes,

Pete

Re-saving the project with a recent Projucer should also fix this.

Thanks Ed!

Seems to work as suggested - thanks again, Ed! Pete

1 Like