Crashlytics NDK符号和Gradle任务 [英] Crashlytics NDK symbols and Gradle tasks

查看:945
本文介绍了Crashlytics NDK符号和Gradle任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用Crashlytics在我的Android应用程序中报告NDK崩溃。
我在build.gradle中调用了ndk-build并将cpp文件编译为.so文件。
在这个任务结束时,我想调用一个上传生成的符号映射到Crashlytics的任务。



在Android Studio中安装Fabric插件后,我看到有一些添加到Gradle选项卡的新任务。其中之一是
crashlyticsUploadSymbols [buildType] [flavor]其中buildType和flavor表示当前选择了哪种buildtype和flavor。



这个任务看起来像上传符号文件。

我的问题是,
是否可以在build.gradle中调用此任务?
目前我在Android Studio的终端选项卡中使用手动调用: b
$ b

是否可以从build.gradle中以某种方式调用此任务?



为了调用此任务,我使用finalizedBy buildNdk任务,所以一旦buildNdk完成,上传任务就会执行。



同样非常重要的是,我如何获取当前的buildType和flavor,以便能够添加它给crashlyticsUploadSymbols调用了吗?



谢谢!

解决方案

Mike从Crashlytics和织物这里。



这也在Twitter社区论坛上得到了回复,但在这里共享相同的答案。



选项1:

如果您只想要或需要上传适用于您的发布版本的符号,则可以将 crashlticsUploadSymbolsRelease 设置为 finalizedBy 任务。

选项2:
如果您有多个基于变体的任务,你可以这样做:

  android.applicationVariants.all {variant  - > 
def variantName = variant.name.capitalize()
def task = project.task(ndkBuild $ {variantName})
task.finalizedBy项目(crashlyticsUploadSymbols $ {variantName} )
}


I have a question that mostly relates to gradle.

I'm using Crashlytics to report NDK crashes in my Android app. I have a task in build.gradle that calls ndk-build and compiles the cpp files into an .so file. At the end of this task I want to call a task that uploads generated symbols mapping to Crashlytics.

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

This task does seem to upload a symbols file.

My question is, Is it possible to call this task from within build.gradle? Currently I use a manual call in Android Studio's terminal tab in the form of:

./gradlew crashlyticsUploadSymbols[buildType][flavour]

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

To call this task I use finalizedBy at the end of the buildNdk task, so once buildNdk has finished, the upload task will execute.

Also very important, how can I get the current buildType and flavour so I am able to add it to the crashlyticsUploadSymbols call?

Thank you!

解决方案

Mike from Crashlytics and Fabric here.

This was also answered on the Twitter Community forum's, but sharing the same answer here.

Option 1:

If you only want or need to upload symbols for your release builds, then you can set crashlticsUploadSymbolsRelease as the finalizedBy task for your ndk-build task.

Option 2: If you have multiple variant-based tasks, 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}")
}

这篇关于Crashlytics NDK符号和Gradle任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆