Android Crashlytics ndk; values of NdkOut and NdkLibsOut in build.gradle

6.9k views Asked by At

I have integrated Crashlytics, Fabric into my app, the sdk related crashes are reported successfully.

For the ndk part, i have followed instructions from the blog; The Wait is Over: Launching Crashlytics for Android NDK, but the ndk crashes aren't being reported. My doubt is, because other parts are sufficiently clear, i'm not providing the correct path for androidNdkOut and androidNdkLibsOut, as shown in:

enter image description here

The doubt and question is in my build.gradle, here it is...

crashlytics {  

    enableNdk true
    androidNdkOut //what would be the obj here?
    androidNdkLibsOut 'src/main/jniLibs' //path for my jni libraries  

}

please let me know if i should post any other part of the code

3

There are 3 answers

0
Pararth On BEST ANSWER

EDIT/UPDATE July 7, 2017

Matt from the Fabric team here with an update to this answer - we just released the Fabric Gradle plugin version 1.23.0 which includes support for automatically detecting the appropriate native library paths when you're using the externalNativeBuild DSL with the Android plugin for Gradle version 2.2.0+, so you no longer need to set the androidNdkOut and androidNdkLibsOut properties. This will work with both CMake and ndk-build. Check out more info here: https://docs.fabric.io/android/crashlytics/ndk.html#specifying-the-path-to-debug-and-release-binaries


I could solve the problem after getting help from Crashlytics/Fabric Support, thanking them..this answer.

First, for

crashlytics {  

    enableNdk true
    androidNdkOut //what would be the obj here?
    androidNdkLibsOut 'src/main/jniLibs' //path for my jni libraries  

}  

for my app's build.gradle, it should have been:

crashlytics {
    enableNdk true
    androidNdkOut 'src/main/jniLibs'
    androidNdkLibsOut 'src/main/jniLibs'
}  

androidNdkOut is where your debug binaries are located. This defaults to 'src/main/obj' but you can set in the crashlytics { } if it's different in your project.

a link which contains useful information on the same: crashlytics knowledgebase; Missing line numbers in native crashes

A minor but very useful part was running commands like uploadReleaseSymbols with the --stacktrace option. Thought its worth the mention as that(uploading release symbols) was also an issue on my side for not receiving the crash reports.

1
Anton On

Follow this guide -https://fabric.io/downloads/gradle/ndk. We kept empty both fields (androidNdkOut and NdkLibsOut)

1
efuruki On

Had a similar problem: I had to add CrashlyticsNdk kit at Fabric.with().

Fabric fabric = new Fabric.Builder(context)
    .kits(new Twitter(authConfig), new Crashlytics(), new CrashlyticsNdk())
    .debuggable(true)
    .build();
Fabric.with(fabric);

you can check androidNdkOut, androidNdkLibsOut this way.

$ ./gradlew -d clean assemble{Flavor} | grep ndk-build

and you will find NDK_OUT and NDK_LIBS_OUT.