Crashlytics Creating an NDK Character from the Command Line

I am trying to add Crashlytics support to my Android project which uses NDK and gradle CMake. This means that I need symbols for my common projects. Therefore, if I want to create characters for the release build, I will call gradlew crashlyticsUploadSymbolsRelease

The official document https://docs.fabric.io/android/crashlytics/ndk.html says that the process of generating and loading symbols assumes a standard project structure: src / main / obj for debug binaries and src / main / libs for executable files releases created by ndk-build.

In the gradle file, this means a new block that looks like this:

 crashlytics { enableNdk true androidNdkOut 'src/main/obj' androidNdkLibsOut 'src/main/libs' } 

Since I use CMake gradle integration to create my native libraries, the default paths certainly don't work. My native libraries in release mode are built into the build/intermediates/cmake/release/obj directory, and in debug mode they go to the build/intermediates/cmake/debug/obj directory.

From trial and error, I realized that if I want my build version to work, I will have to put the path to the source libraries of the release mode on both lines, as shown below.

 crashlytics { enableNdk true androidNdkOut 'build/intermediates/cmake/release/obj' androidNdkLibsOut 'build/intermediates/cmake/release/obj' } 

I just do not understand the difference between the androidNdkOut and androidNdkLibsOut , because at least in my script they point to the same directory. Fortunately, this is not a problem for me, because I just need Crashlytics to work with my versions.

So my questions are:

1) Actually the difference between androidNdkOut and androidNdkLibsOut ? Why can't I put the path to my debug binaries in one path and the path to release binaries for another? A concrete example would be nice in addition to the explanation.

2) How do I change the gradle file if at some point I want to include characters for my debug libraries? gradlew crashlyticsUploadSymbolsRelease this mean that the gradlew crashlyticsUploadSymbolsRelease as well as the gradlew crashlyticsUploadSymbolsDebug will work?

This is stated in the streams Symbols Crashlytics NDK and gradle tasks and Crashlytics NDK multi androidNdkOut support path , but they really do not answer these two questions.

+5
source share
1 answer

I am working on a Fabric team that supports our NDK Crashlytics support.

To give some context, our character loading tool is based on the ndk-build process, which creates 2 sets of binaries: your production binaries that are devoid of symbol data and debug binaries that do not have symbol data for debugging purposes.

Gradle properties are displayed in variables during the ndk-build process, in particular:

  • androidNdkOut is the directory where the $NDK_OUT debug binaries are located (equivalent to the $NDK_OUT variable in ndk-build ) by default obj .
  • androidNdkLibsOut is the directory where the split, released binaries are located (equivalent to the $NDK_LIBS_OUT variable in ndk-build ) by default libs .

The expected contents of these paths are architecture-specific directories for your libraries, for example:

 obj/ — armeabi — lib1.so — lib2.so — x86 — lib1.so — lib2.so libs/ — armeabi — lib1.so — lib2.so — x86 — lib1.so — lib2.so 

All you need to do to download our symbol is to generate the same binary androidNdkOut from CMake, and then install androidNdkOut and androidNdkLibsOut in the corresponding top-level directories where these libraries can be found.

EDIT / UPDATE July 7, 2017

We just released version 1.23.0 of the Fabric plugin for Gradle, which supports automatically resolving the corresponding paths of the source library when you use the Android Gradle 2.2.0+ plugin using externalNativeBuild DSL, so you no longer need to set androidNdkOut and androidNdkLibsOut if you use The latest Android Gradle plugin. Read more here: https://docs.fabric.io/android/crashlytics/ndk.html#specifying-the-path-to-debug-and-release-binaries

+3
source

Source: https://habr.com/ru/post/1258477/


All Articles