最新版 Crashlytics Gradle 外掛程式是主要版本 (3.0.0 版),並捨棄對舊版 Gradle 和 Android Gradle 外掛程式的支援,翻新 SDK。此外,這個版本的變更已解決 AGP 8.1 以上版本的問題,並改善原生應用程式和自訂建構作業的支援功能。
基本規定
Crashlytics Gradle 外掛程式 v3 的最低需求如下:
Android Gradle 外掛程式 8.1 以上版本
在最新版 Android Studio 中使用 Android Gradle 外掛程式升級小幫手升級這個外掛程式。Firebase 的
google-services
Gradle 外掛程式 4.4.1 以上版本
如要升級這個外掛程式,請在專案的 Gradle 建構檔案中指定最新版本,如下所示:
Kotlin
plugins { id("com.android.application") version "8.1.4" apply false id("com.google.gms.google-services") version "4.4.1" apply false ... }
Groovy
plugins { id 'com.android.application' version '8.1.4' apply false id 'com.google.gms.google-services' version '4.4.1' apply false ... }
Crashlytics 擴充功能的相關異動
使用 Crashlytics Gradle 外掛程式 v3 時,Crashlytics 擴充功能會產生下列破壞性變更:
將擴充功能從
defaultConfig
Android 區塊中移除。您應改為設定每個變化版本。移除已淘汰的欄位
mappingFile
。系統現在會自動提供合併的對應檔案。移除已淘汰的欄位
strippedNativeLibsDir
。建議您針對所有原生程式庫使用unstrippedNativeLibsDir
。已將
unstrippedNativeLibsDir
欄位變更為累計。已將關閉欄位
symbolGenerator
替換為兩個新頂層欄位:symbolGeneratorType
,"breakpad"
(預設) 或"csym"
的字串。breakpadBinary
,本機dump_syms
二進位檔覆寫檔案。
升級擴充功能範例
Kotlin
之前 |
buildTypes { release { configure<CrashlyticsExtension> { // ... symbolGenerator( closureOf<SymbolGenerator> { symbolGeneratorType = "breakpad" breakpadBinary = file("/PATH/TO/BREAKPAD/DUMP_SYMS") } ) } } } |
現已推出 v3 |
buildTypes { release { configure<CrashlyticsExtension> { // ... symbolGeneratorType = "breakpad" breakpadBinary = file("/PATH/TO/BREAKPAD/DUMP_SYMS") } } } |
Groovy
之前 |
buildTypes { release { firebaseCrashlytics { // ... symbolGenerator { breakpad { binary file("/PATH/TO/BREAKPAD/DUMP_SYMS") } } } } } |
現已推出 v3 |
buildTypes { release { firebaseCrashlytics { // ... symbolGeneratorType "breakpad" breakpadBinary file("/PATH/TO/BREAKPAD/DUMP_SYMS") } } } |