[Solved] Crash on Android latest tip

I am getting a crash on Android from the latest JUCE tip. 

These seem to be the relevant logcat lines:

D/dalvikvm(11402): Trying to load lib /data/app-lib/com.nodeaudio.myapp-1/libjuce_jni.so 0x41f457d0

I/libblt_hw( 1810): Library closed (handle = 0, fd = 32)

I/JUCE    (11402): *** Call to getEnv() when system not initialised

I/JUCE    (11402): JUCE Assertion failure in juce_android_SystemStats.cpp:113

I/JUCE    (11402): *** Leaked objects detected: 1 instance(s) of class AndroidTypeface

I/JUCE    (11402): JUCE Assertion failure in juce_LeakedObjectDetector.h:95

I/JUCE    (11402): *** Leaked objects detected: 1 instance(s) of class Typeface

I/JUCE    (11402): JUCE Assertion failure in juce_LeakedObjectDetector.h:95

D/Zygote  ( 1804): Process 11402 exited cleanly (1)

I/ActivityManager( 2230): Process com.nodeaudio.myapp (pid 11402) has died.

 

Would need an actual crash trace to be any help. That log just tells us that the process finished, nothing else.

OK I've sent you the full adb logcat output from the debug apk, via email. 

Finally managed to track this one down. I had a few hoops to jump through to get the ndk-gdb debugger to attach to the app process - I had to add a Thread.sleep in the java activity for a couple seconds to give the debugger time to attach before it crashed.

Anyhow it was due to a module that has an issue with JUCE on Android  - danlin's FontAwesome wrapper module. 

Hi adamski,

Thank you for sending me your stack trace. In deed, the problem is that danlin's FontAwesome wrapper is calling juce::Typeface::createSystemTypefaceFor before JUCE is fully initialized. This is because juce::Typeface::createSystemTypefaceFor is called from the static initializer of a global instance of FontAwesomeHelper here. This is another example of why it is bad to have global variables. It is better to replace this with a singleton object. You can use juce_DeclareSingleton and friends for this (modules/juce_core/memory/juce_Singleton.h).

Fabian

Thx for this tip.

I fix this...

Just to say that danlin has now fixed the issue with the FontAwesome wrapper on Android. Thank you :)

And apologies to JUCE team for the red herring ! Thanks also to Fabian for helping to debug the issue.