Issue
I integrated Crashlytics into Android app with C++ parts (made with Cocos Creator). Crashes in Java (Crashlytics.getInstance().crash()
) logged just fine and they are visible in Firebase Crashlytics console. But crashes in C++ are not detected. So I followed instructions to turn on Crashlytics detailed logs and noticed that NDK kit is missing from the list of kits that Crashlytics initialized with:
06-06 19:13:55.241 9174 9174 D CrashlyticsCore: Exception handling initialization successful
06-06 19:13:55.242 9174 9174 D Fabric : Initializing io.fabric.sdk.android:fabric [Version: 1.4.8.32], with the following kits:
06-06 19:13:55.242 9174 9174 D Fabric : com.crashlytics.sdk.android:answers [Version: 1.4.7.32]
06-06 19:13:55.242 9174 9174 D Fabric : com.crashlytics.sdk.android:beta [Version: 1.2.10.27]
06-06 19:13:55.242 9174 9174 D Fabric : com.crashlytics.sdk.android:crashlytics [Version: 2.10.1.34]
06-06 19:13:55.242 9174 9174 D Fabric : com.crashlytics.sdk.android.crashlytics-core [Version: 2.7.0.33]
06-06 19:13:55.242 9174 9174 D Fabric :
06-06 19:13:55.253 9174 9245 D CrashlyticsCore: Opening a new session with ID ...
./build.gradle
buildscript {
....
dependencies {
....
classpath 'io.fabric.tools:gradle:1.29.0'
}
....
}
./app/build.gradle
apply plugin: 'io.fabric'
...
crashlytics {
enableNdk true
}
...
dependencies {
...
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.1.0'
...
}
UPDATE
NDK disappears from kits list when I use
<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />
and later initialize it with
Fabric.with(this, new Crashlytics());
in order to get user's consent first for GDPR compliance.
Should I initialize Crashlytics NDK kit from C++ via JNI in that case?
Solution
If you postpone Crashlytics initialization to acquire users's consent using
<meta-data android:name="firebase_crashlytics_collection_enabled" android:value="false" />
then to activate ndk-kit later you have to explicitly enlist it as an argument to Fabric.with
:
Fabric.with(this, new Crashlytics(), new CrashlyticsNdk());
I hope Firebase/Crashlytics will update "opt-in reporting" section of the documentation to mention that.
Answered By - Ilya Denisov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.