最新版本的 Crashlytics Gradle 外掛程式是主要版本 (3.0.0 版),且會停止支援較舊版本的 Gradle 和 Android Gradle 外掛程式,以便將 SDK 現代化。此外,這個版本中的變更可解決 AGP 8.1 以上版本的問題,並改善對原生應用程式和自訂版本的支援。
基本規定
Crashlytics Gradle 外掛程式第 3 版的最低需求如下:
Android Gradle 外掛程式 8.1 以上版本
請在最新版 Android Studio 上使用 Android Gradle 外掛程式升級工具升級此外掛程式。Firebase 的
google-services
Gradle 外掛程式 4.4.1 以上版本
請在專案的 Gradle 建構檔案中指定最新版本,藉此升級此外掛程式,如下所示:
plugins { id("com.android.application") version "8.1.4" apply false id("com.google.gms.google-services") version "4.4.2" apply false ... }
plugins { id 'com.android.application' version '8.1.4' apply false id 'com.google.gms.google-services' version '4.4.2' apply false ... }
Crashlytics 擴充功能異動
在 Crashlytics Gradle 外掛程式的第 3 版中,Crashlytics 擴充功能有以下破壞性變更:
已從
defaultConfig
Android 區塊中移除擴充功能。請改為設定每個變化版本。移除已淘汰的欄位
mappingFile
。而是自動提供合併的對應檔案。移除已淘汰的欄位
strippedNativeLibsDir
。相反地,您應為所有原生程式庫使用unstrippedNativeLibsDir
。將
unstrippedNativeLibsDir
欄位變更為累積值。查看包含多個目錄的範例
buildTypes { release { configure<CrashlyticsExtension> { nativeSymbolUploadEnabled = true unstrippedNativeLibsDir = file("
MY/NATIVE/LIBS ") } } productFlavors { flavorDimensions += "feature" create("basic") { dimension = "feature" // ... } create("featureX") { dimension = "feature" configure<CrashlyticsExtension> { unstrippedNativeLibsDir = file("MY/FEATURE_X/LIBS ") } } } }uploadCrashlyticsSymbolFilesBasicRelease
工作只會上傳MY/NATIVE/LIBS
中的符號,但uploadCrashlyticsSymbolFilesFeatureXRelease
會上傳MY/NATIVE/LIBS
和MY/FEATURE_X/LIBS
中的符號。將結束欄位
symbolGenerator
替換為兩個新的頂層欄位:symbolGeneratorType
:字串,可為"breakpad"
(預設) 或"csym"
。breakpadBinary
:本機dump_syms
二進位檔覆寫值的檔案。
擴充功能升級方法示例
之前 |
buildTypes { release { configure<CrashlyticsExtension> { // ... symbolGenerator( closureOf<SymbolGenerator> { symbolGeneratorType = "breakpad" breakpadBinary = file(" |
現已推出 v3 版 |
buildTypes { release { configure<CrashlyticsExtension> { // ... symbolGeneratorType = "breakpad" breakpadBinary = file(" |
之前 |
buildTypes { release { firebaseCrashlytics { // ... symbolGenerator { breakpad { binary file(" |
現已推出 v3 版 |
buildTypes { release { firebaseCrashlytics { // ... symbolGeneratorType "breakpad" breakpadBinary file(" |