Android crashes when receiving push notifications

Hey,

so I only just now realized, that our app is crashing, when it receives pushnotifications. This is the output I get:

Logcat:

2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470] JNI DETECTED ERROR IN APPLICATION: can't call java.lang.String android.net.Uri.toString() on null object
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]     in call to CallObjectMethodV
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]     from java.lang.Object com.roli.juce.JuceInvocationHandler.dispatchInvoke(long, java.lang.Object, java.lang.reflect.Method, java.lang.Object[])
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470] "main" prio=5 tid=1 Runnable
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   | group="main" sCount=0 dsCount=0 obj=0x74d5ae80 self=0xa4505400
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   | sysTid=26060 nice=-10 cgrp=default sched=0/0 handle=0xa71e0534
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   | state=R schedstat=( 1184783206 18812543 812 ) utm=108 stm=9 core=0 HZ=100
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   | stack=0xbe608000-0xbe60a000 stackSize=8MB
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   | held mutexes= "mutator lock"(shared held)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #00 pc 0034e8d1  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #01 pc 0032f295  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+308)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #02 pc 00238b7d  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+848)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #03 pc 0023909f  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+58)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #04 pc 000ca37b  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+46)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #05 pc 000cca5f  /system/lib/libart.so (_ZN3art11ScopedCheck17CheckMethodAndSigERNS_18ScopedObjectAccessEP8_jobjectP7_jclassP10_jmethodIDNS_9Primitive4TypeENS_10InvokeTypeE+986)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #06 pc 000cbc4f  /system/lib/libart.so (_ZN3art8CheckJNI11CallMethodVEPKcP7_JNIEnvP8_jobjectP7_jclassP10_jmethodIDSt9__va_listNS_9Primitive4TypeENS_10InvokeTypeE+538)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #07 pc 000c146f  /system/lib/libart.so (_ZN3art8CheckJNI17CallObjectMethodVEP7_JNIEnvP8_jobjectP10_jmethodIDSt9__va_list+42)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #08 pc 0081c03c  /data/app/de.wavecasual.boothbuddy-2/lib/arm/libjuce_jni.so (_ZN7_JNIEnv16CallObjectMethodEP8_jobjectP10_jmethodIDz+108)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #09 pc 00e50d44  /data/app/de.wavecasual.boothbuddy-2/lib/arm/libjuce_jni.so (_ZN4juce17PushNotifications5Pimpl44firebaseRemoteNotificationToJuceNotificationEP8_jobject+4976)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #10 pc 00e4f95c  /data/app/de.wavecasual.boothbuddy-2/lib/arm/libjuce_jni.so (_ZZN4juce17PushNotifications5Pimpl49notifyListenersAboutRemoteNotificationFromServiceERKNS_8LocalRefIP8_jobjectEEENKUlvE_clEv+72)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #11 pc 00e4f908  /data/app/de.wavecasual.boothbuddy-2/lib/arm/libjuce_jni.so (_ZNSt6__ndk128__invoke_void_return_wrapperIvE6__callIJRZN4juce17PushNotifications5Pimpl49notifyListenersAboutRemoteNotificationFromServiceERKNS3_8LocalRefIP8_jobjectEEEUlvE_EEEvDpOT_+44)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #12 pc 00e4f728  /data/app/de.wavecasual.boothbuddy-2/lib/arm/libjuce_jni.so (_ZNSt6__ndk110__function6__funcIZN4juce17PushNotifications5Pimpl49notifyListenersAboutRemoteNotificationFromServiceERKNS2_8LocalRefIP8_jobjectEEEUlvE_NS_9allocatorISB_EEFvvEEclEv+40)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #13 pc 00631168  /data/app/de.wavecasual.boothbuddy-2/lib/arm/libjuce_jni.so (_ZNKSt6__ndk18functionIFvvEEclEv+136)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #14 pc 00ae7764  /data/app/de.wavecasual.boothbuddy-2/lib/arm/libjuce_jni.so (???)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #15 pc 00af16f4  /data/app/de.wavecasual.boothbuddy-2/lib/arm/libjuce_jni.so (_ZN4juce19AndroidMessageQueue3runEv+108)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #16 pc 00af15d4  /data/app/de.wavecasual.boothbuddy-2/lib/arm/libjuce_jni.so (_ZN4juce7Android8Runnable6invokeEP8_jobjectS3_P13_jobjectArray+152)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #17 pc 009d85b8  /data/app/de.wavecasual.boothbuddy-2/lib/arm/libjuce_jni.so (_ZN4juce22juce_invokeImplementerEP7_JNIEnvP8_jobjectxS3_S3_P13_jobjectArray+100)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   native: #18 pc 000001b9  /data/data/de.wavecasual.boothbuddy/code_cache/optimized_cache/6e355cbe3d54c448d32a1c21f0f63c22c6609998.dex (Java_com_roli_juce_JuceInvocationHandler_dispatchInvoke__JLjava_lang_Object_2Ljava_lang_reflect_Method_2_3Ljava_lang_Object_2+172)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at com.roli.juce.JuceInvocationHandler.dispatchInvoke(Native method)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at com.roli.juce.JuceInvocationHandler.invoke(unavailable:-1)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at java.lang.reflect.Proxy.invoke(Proxy.java:813)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at java.lang.Runnable.run(Runnable.java:-2)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at android.os.Handler.handleCallback(Handler.java:751)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at android.os.Handler.dispatchMessage(Handler.java:95)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at android.os.Looper.loop(Looper.java:154)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at android.app.ActivityThread.main(ActivityThread.java:6123)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at java.lang.reflect.Method.invoke!(Native method)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
2019-09-19 13:42:34.635 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/java_vm_ext.cc:470] 
2019-09-19 13:42:34.897 26060-26060/de.wavecasual.boothbuddy A/art: art/runtime/runtime.cc:441] Runtime aborting...

Stacktrace:

tgkill 0x00000000a471dbc4
pthread_kill 0x00000000a471b366
raise 0x00000000a46f1538
__libc_android_abort 0x00000000a46ed084
abort 0x00000000a46eb0e8
art::Runtime::Abort() 0x00000000a432d074
art::LogMessage::~LogMessage() 0x00000000a40c897c
art::JavaVMExt::JniAbort(char const*, char const*) 0x00000000a424ceb0
art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list) 0x00000000a424d0a2
art::ScopedCheck::AbortF(char const*, ...) 0x00000000a40de37e
art::ScopedCheck::CheckMethodAndSig(art::ScopedObjectAccess&, _jobject*, _jclass*, _jmethodID*, art::Primitive::Type, art::InvokeType) 0x00000000a40e0a62
art::CheckJNI::CallMethodV(char const*, _JNIEnv*, _jobject*, _jclass*, _jmethodID*, std::__va_list, art::Primitive::Type, art::InvokeType) 0x00000000a40dfc52
art::CheckJNI::CallObjectMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list) 0x00000000a40d5472
_JNIEnv::CallObjectMethod(_jobject*, _jmethodID*, ...) jni.h:618
juce::PushNotifications::Pimpl::firebaseRemoteNotificationToJuceNotification(_jobject*) juce_android_PushNotifications.cpp:1402
juce::PushNotifications::Pimpl::notifyListenersAboutRemoteNotificationFromService(juce::LocalRef<_jobject*> const&)::'lambda'()::operator()() const juce_android_PushNotifications.cpp:552
decltype(std::__ndk1::forward<juce::PushNotifications::Pimpl::notifyListenersAboutRemoteNotificationFromService(juce::LocalRef<_jobject*> const&)::'lambda'()&>(fp)()) std::__ndk1::__invoke<juce::PushNotifications::Pimpl::notifyListenersAboutRemoteNotificationFromService(juce::LocalRef<_jobject*> const&)::'lambda'()&>(juce::PushNotifications::Pimpl::notifyListenersAboutRemoteNotificationFromService(juce::LocalRef<_jobject*> const&)::'lambda'()&&&) type_traits:4350
void std::__ndk1::__invoke_void_return_wrapper<void>::__call<juce::PushNotifications::Pimpl::notifyListenersAboutRemoteNotificationFromService(juce::LocalRef<_jobject*> const&)::'lambda'()&>(juce::PushNotifications::Pimpl::notifyListenersAboutRemoteNotificationFromService(juce::LocalRef<_jobject*> const&)::'lambda'()&&&) __functional_base:349
std::__ndk1::__function::__func<juce::PushNotifications::Pimpl::notifyListenersAboutRemoteNotificationFromService(juce::LocalRef<_jobject*> const&)::'lambda'(), std::__ndk1::allocator<juce::PushNotifications::Pimpl::notifyListenersAboutRemoteNotificationFromService(juce::LocalRef<_jobject*> const&)::'lambda'()>, void ()>::operator()() functional:1572
std::__ndk1::function<void ()>::operator()() const functional:1923
juce::MessageManager::callAsync(std::__ndk1::function<void ()>)::AsyncCallInvoker::messageCallback() juce_MessageManager.cpp:192
juce::AndroidMessageQueue::run() juce_android_Messaging.cpp:104
juce::Android::Runnable::invoke(_jobject*, _jobject*, _jobjectArray*) juce_android_Messaging.cpp:42
juce::juce_invokeImplementer(_JNIEnv*, _jobject*, long long, _jobject*, _jobject*, _jobjectArray*) juce_android_JNIHelpers.cpp:400
<unknown> 0x00000000a32281ba

Crashes on this line:
https://github.com/WeAreROLI/JUCE/blob/master/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp#L1402

And must have happened somewhere after I updated to this, because of another crash. The version I was using before was something like 5.4. I’m not really sure.

I’d be really thankful if this could be solved faster than in a month, because we are on a tight schedule.

Thanks in advance!

Maybe it is somehow related to the issue I had few days ago after upgrading to 5.4.4?

Can at least somebody from the team confirm that this is a JUCE bug?

Bump

bump

Does the JUCE PushNotificationsDemo example crash for you? I’ve just tried it in both the emulator and on a real device and I can send and receive push notifications as expected.

That crashes too, but somewhere different.

2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441] Runtime aborting...
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441] Aborting thread:
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441] "main" prio=10 tid=1 Native
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   | group="" sCount=0 dsCount=0 obj=0x74d5ae80 self=0xa4505400
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   | sysTid=22085 nice=-10 cgrp=default sched=0/0 handle=0xa71e0534
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   | state=R schedstat=( 9436594391 44670980 906 ) utm=911 stm=31 core=1 HZ=100
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   | stack=0xbe608000-0xbe60a000 stackSize=8MB
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   | held mutexes= "abort lock"
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #00 pc 0034e8d1  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #01 pc 0032f295  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+308)
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #02 pc 00322429  /system/lib/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+24)
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #03 pc 003222b1  /system/lib/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+424)
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #04 pc 00318fcf  /system/lib/libart.so (_ZN3art7Runtime5AbortEv+90)
2019-10-07 14:39:13.492 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #05 pc 000b4979  /system/lib/libart.so (_ZN3art10LogMessageD2Ev+864)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #06 pc 00238ead  /system/lib/libart.so (_ZN3art9JavaVMExt8JniAbortEPKcS2_+1664)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #07 pc 0023909f  /system/lib/libart.so (_ZN3art9JavaVMExt9JniAbortVEPKcS2_St9__va_list+58)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #08 pc 000ca37b  /system/lib/libart.so (_ZN3art11ScopedCheck6AbortFEPKcz+46)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #09 pc 000c9f67  /system/lib/libart.so (_ZN3art11ScopedCheck11CheckThreadEP7_JNIEnv+362)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #10 pc 000c8f7f  /system/lib/libart.so (_ZN3art11ScopedCheck22CheckPossibleHeapValueERNS_18ScopedObjectAccessEcNS_12JniValueTypeE+26)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #11 pc 000c845b  /system/lib/libart.so (_ZN3art11ScopedCheck5CheckERNS_18ScopedObjectAccessEbPKcPNS_12JniValueTypeE+802)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #12 pc 000cf6d1  /system/lib/libart.so (_ZN3art8CheckJNI17NewPrimitiveArrayEPKcP7_JNIEnviNS_9Primitive4TypeE+452)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #13 pc 007844b8  /data/app/com.juce.pushnotificationsdemo-1/lib/arm/libjuce_jni.so (_ZN7_JNIEnv11NewIntArrayEi+48)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #14 pc 00a9c474  /data/app/com.juce.pushnotificationsdemo-1/lib/arm/libjuce_jni.so (_ZNK4juce20AndroidComponentPeer17getScreenPositionEv+60)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #15 pc 00a9af0c  /data/app/com.juce.pushnotificationsdemo-1/lib/arm/libjuce_jni.so (_ZN4juce20AndroidComponentPeer13globalToLocalENS_5PointIfEE+64)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #16 pc 00a19e9c  /data/app/com.juce.pushnotificationsdemo-1/lib/arm/libjuce_jni.so (_ZN4juce24MouseInputSourceInternal15findComponentAtENS_5PointIfEE+128)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #17 pc 00a194d8  /data/app/com.juce.pushnotificationsdemo-1/lib/arm/libjuce_jni.so (_ZN4juce24MouseInputSourceInternal12setScreenPosENS_5PointIfEENS_4TimeEb+108)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #18 pc 0090e800  /data/app/com.juce.pushnotificationsdemo-1/lib/arm/libjuce_jni.so (_ZN4juce24MouseInputSourceInternal11handleEventERNS_13ComponentPeerENS_5PointIfEENS_4TimeENS_12ModifierKeysEffNS_10PenDetailsE+828)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #19 pc 0090e494  /data/app/com.juce.pushnotificationsdemo-1/lib/arm/libjuce_jni.so (_ZN4juce16MouseInputSource11handleEventERNS_13ComponentPeerENS_5PointIfEExNS_12ModifierKeysEffRKNS_10PenDetailsE+256)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #20 pc 009f4b48  /data/app/com.juce.pushnotificationsdemo-1/lib/arm/libjuce_jni.so (_ZN4juce13ComponentPeer16handleMouseEventENS_16MouseInputSource15InputSourceTypeENS_5PointIfEENS_12ModifierKeysEffxNS_10PenDetailsEi+300)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #21 pc 00a99e84  /data/app/com.juce.pushnotificationsdemo-1/lib/arm/libjuce_jni.so (_ZN4juce20AndroidComponentPeer21handleMouseUpCallbackEiNS_5PointIfEEx+464)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #22 pc 00a982ac  /data/app/com.juce.pushnotificationsdemo-1/lib/arm/libjuce_jni.so (_ZN4juce20AndroidComponentPeer16handleMouseUpJniEP7_JNIEnvP8_jobjectxiffx+184)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   native: #23 pc 00000ea5  /data/data/com.juce.pushnotificationsdemo/code_cache/optimized_cache/af1dd29b8d554a37ae14f8b5ea687565aa44e09a.dex (???)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at com.roli.juce.ComponentPeerView.handleMouseUp(Native method)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at com.roli.juce.ComponentPeerView.onTouchEvent(ComponentPeerView.java:135)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.View.dispatchTouchEvent(View.java:9945)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2666)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2344)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.View.dispatchPointerEvent(View.java:10165)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4446)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4314)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3861)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3914)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3880)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4007)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3888)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4064)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3861)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3914)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3880)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3888)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3861)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6257)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6196)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6157)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6360)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:192)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.os.MessageQueue.nativePollOnce(Native method)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.os.MessageQueue.next(MessageQueue.java:323)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.os.Looper.loop(Looper.java:136)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at android.app.ActivityThread.main(ActivityThread.java:6123)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at java.lang.reflect.Method.invoke!(Native method)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
2019-10-07 14:39:13.493 22085-22085/com.juce.pushnotificationsdemo A/art: art/runtime/runtime.cc:441]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

Which is about here:

I doubt it’s actually crashing on that line and instead there’s probably an uncaught exception somewhere. There should be a line in logcat a bit further up about UncaughtExceptionHandler or something similar, can you post that?

Also it’d be good to know which devices and version of the SDK you’re targeting when this occurs.

For the demo I get this an java.lang.IllegalArgumentException: Invalid notification (no valid small icon) probably because the ressources are not correctly added.
I’d like to get the focus back to original problem, since setting up the demo is a pain and I can definitely point to the problem.

If I comment out this line, everything is again working as expected.
The phone is running Android 7.0. Minimum SDK version is 24.

Ok, so I’m pretty sure the check in that line simply needs to be link.get() != nullptr.
Am I right?

Yep, will get that sorted out. Apologies for the delay!

Could you please also change this line https://github.com/WeAreROLI/JUCE/blob/master/modules/juce_gui_extra/native/juce_android_PushNotifications.cpp#L1564

to this:

static void JNICALL tokenRefreshed (JNIEnv*, jobject, void* token)

To be honest, I have no idea what is happening here. But I got this fix from Lukasz here:

Without that change the app crashes at the first start after a fresh installation.

Yep, will do.