I’ve used Crashlytics in other projects so am reasonably familiar with it.
For my JUCE project, I have setup Crashlytics following the relevant guides for Installing Crashlytics and enabling NDK crash monitoring.
Also from this forum I checked out:
When I run up my app in Android Studio, Crashlytics seems to start up okay:
2020-11-17 17:23:11.361 19708-19708/com.cburn.revdesktop I/FirebaseCrashlytics: Initializing Crashlytics 17.3.0
2020-11-17 17:23:11.457 19708-19730/com.cburn.revdesktop D/libcrashlytics: Initializing libcrashlytics version 3.0.0
2020-11-17 17:23:11.457 19708-19730/com.cburn.revdesktop D/libcrashlytics: Initializing native crash handling successful.
2020-11-17 17:23:11.458 19708-19730/com.cburn.revdesktop I/FirebaseCrashlytics: Crashlytics NDK initialization successful
And if I throw an exception on the java side e.g.
public class JuceActivity extends Activity {
private native void appNewIntent(Intent intent);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
throw new RuntimeException("JuceActivity test exception");
}
Then I can see the crash both in Logcat :
2020-11-17 17:56:08.125 21292-21376/com.cburn.revdesktop D/libcrashlytics: Initializing libcrashlytics version 3.0.0
2020-11-17 17:56:08.125 21292-21376/com.cburn.revdesktop D/libcrashlytics: Initializing native crash handling successful.
2020-11-17 17:56:08.125 21292-21376/com.cburn.revdesktop I/FirebaseCrashlytics: Crashlytics NDK initialization successful
2020-11-17 17:56:08.416 21292-21379/com.cburn.revdesktop D/TransportRuntime.SQLiteEventStore: Storing event with priority=HIGHEST, name=FIREBASE_CRASHLYTICS_REPORT for destination cct
and immediately afterwards :
2020-11-17 17:56:14.361 21396-21421/com.cburn.revdesktop D/TransportRuntime.CctTransportBackend: Making request to: https://crashlyticsreports-pa.googleapis.com/v1/firelog/legacy/batchlog
The crash then appears correctly in the Firebase Crashlytics console.
However when I generate a NDK crash in a .cpp e.g by calling :
void crashTest() {
int a=0;
int b=1;
printf(“%d”,b/a);
}
My JUCE app crashes as expected but I don’t get any of the above logging to indicate that Crashlytics caught the crash, nor is the crash uploaded to the Firebase console.
My question is - Is there anything else I need to do on the JUCE side to get Crashlytics to catch things.
My build environment is
- JUCE 5.4.7
- Android Studio 4.1.1
- Gradle 6.5
- Android gradle plugin 4.1.1
In my project level build.gradle :
dependencies {
...
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
}
And in the app build.gradle :
apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' . . .
dependencies {
... // Import the BoM for the Firebase platform implementation platform('com.google.firebase:firebase-bom:26.1.0') // Declare the dependencies for the Crashlytics and Analytics libraries // When using the BoM, you don't specify versions in Firebase library dependencies implementation 'com.google.firebase:firebase-crashlytics-ndk' implementation 'com.google.firebase:firebase-analytics' } debug_ { .... // Add this extension firebaseCrashlytics { // Enable processing and uploading of native symbols to Crashlytics servers. // By default, this is disabled to improve build speeds. // This flag must be enabled to see properly-symbolicated native // stack traces in the Crashlytics dashboard. nativeSymbolUploadEnabled true } } }