Crashlytics NDK Symbols and Gradle Tasks

I have a question that mainly relates to gradle.

I use Crashlytics to report NDK crashes in my Android app. I have a task in build.gradle that calls ndk-build and compiles cpp files to a .so file. At the end of this task, I want to call a task that loads the generated characters into Crashlytics.

After installing the Fabric plugin in Android Studio, I saw new tasks that were added to the Gradle tab. One of them is crashlyticsUploadSymbols [buildType] [flavor], where buildType and flavor indicate which type of build and flavor are currently selected.

This task seems to load a character file.

My question is, Is it possible to call this task from inside build.gradle? I am currently using a manual call on an Android Studio terminal tab in the form:

./gradlew crashlyticsUploadSymbols [buildType] [flavor]

Is it possible to somehow call this task from inside build.gradle?

To call this task, I use finalizedBy at the end of the buildNdk task, so as soon as buildNdk finishes, the download task will be completed.

It is also very important how can I get the current buildType and taste so that I can add it to the crashlyticsUploadSymbols call?

Thanks!

0
source share
2 answers

Mike from Crashlytics and Fabric is here.

This was also answered on the Twitter community forum, but the same answer was given here.

Option 1:

If you want or want to download characters for your release versions, you can set crashlticsUploadSymbolsRelease as the finalizedBy task for your ndk-build task.

Option 2: If you have multiple options based on the options, you can do something like:

 android.applicationVariants.all { variant -> def variantName = variant.name.capitalize() def task = project.task ("ndkBuild${variantName}") task.finalizedBy project.("crashlyticsUploadSymbols${variantName}") } 
+1
source

The following did my job:

 android { ... afterEvaluate { assembleDebug.finalizedBy(crashlyticsUploadSymbolsDebug) assembleRelease.finalizedBy(crashlyticsUploadSymbolsRelease) } } 
0
source

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


All Articles