Crashlytics NDK:自更新到新 SDK 后没有崩溃符号
Crashlytics NDK: No symbols for crashes since update to new sdk
在我们更新到新的 SDK 之前它工作正常,现在它只在报告中显示最后一个 java 堆栈帧。任务 uploadCrashlyticsSymbolFileFlavorDebug 在 externalNativeBuildFlavorDebug 之后立即被调用,但报告中没有符号。我在构建后通过 cli 尝试 运行 它,但仍然没有运气。我没主意了,找不到我哪里出错了
项目级 build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:perf-plugin:1.3.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta02'
}
}
应用程序级 build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'
android {
buildTypes {
release {
debuggable false
firebaseCrashlytics {
nativeSymbolUploadEnabled true
}
}
debug {
debuggable true
firebaseCrashlytics {
nativeSymbolUploadEnabled true
}
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-analytics:17.2.3'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
implementation 'com.google.firebase:firebase-crashlytics-ndk:17.0.0-beta01'
}
afterEvaluate {
android.applicationVariants.all { variant ->
tasks."externalNativeBuild${variant.name.capitalize()}".finalizedBy "uploadCrashlyticsSymbolFile${variant.name.capitalize()}"
}
}
我还从 onCreate
中删除了以下行
Fabric.with(this.spawner, new Crashlytics(), new CrashlyticsNdk());
编辑 1
我检查了调试日志,看看是否一切正常,似乎是:
生成符号
14:24:44.950 [DEBUG] [com.google.firebase.crashlytics] Generating symbols for <BUILD_PATH>\intermediates\ndkBuild\appName\debug\obj\local\armeabi-v7a\libmain.so
14:24:44.950 [DEBUG] [com.google.firebase.crashlytics] Using DWARF data for cSYM generation.
14:25:14.992 [DEBUG] [com.google.firebase.crashlytics] Generating symbols for <BUILD_PATH>\intermediates\ndkBuild\appName\debug\obj\local\armeabi-v7a\libSDL2.so
14:25:14.992 [DEBUG] [com.google.firebase.crashlytics] Using DWARF data for cSYM generation.
已找到 AppId 和 Crashlytics 组织 ID
14:25:15.109 [DEBUG] [com.google.firebase.crashlytics] Getting appId from output of the Google Services plugin at <BUILD_PATH>\generated\res\google-services\appName\debug\values\values.xml
14:25:15.139 [DEBUG] [com.google.firebase.crashlytics] Found Google appId: #:############:android:xxxxxxxxxxxxxxxx
14:25:15.140 [DEBUG] [com.google.firebase.crashlytics] Uploading native symbol files from directory: <BUILD_PATH>\crashlytics\AppNameDebug\nativeSymbols
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] Requesting Legacy Crashlytics settings for #:############:android:xxxxxxxxxxxxxxxx from: http://firebase-settings.crashlytics.com/spi/v2/gmp/#:############:android:xxxxxxxxxxxxxxxx/fabric_ids
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] Request Headers:
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-DEVELOPER-TOKEN : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] User-Agent : crashlytics-gradle/2.0.0-beta02
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-TYPE : crashlytics-gradle
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-VERSION : 2.0.0-beta02
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] Accept : application/json
14:25:15.147 [DEBUG] [com.google.firebase.crashlytics] REQUEST: http://firebase-settings.crashlytics.com/spi/v2/gmp/#:############:android:xxxxxxxxxxxxxxxx/fabric_ids
14:25:15.469 [DEBUG] [com.google.firebase.crashlytics] RESPONSE: 200 [reqId=null]
14:25:15.469 [DEBUG] [com.google.firebase.crashlytics] Crashlytics settings response: Optional.of({"fabric_org_external_id":"xxxxxxxxxxxxxxxxxxxxxxxx","collector_endpoint":1,"fabric_app_external_id":"xxxxxxxxxxxxxxxxxxxxxxxx","fabric_bundle_id":"package.name"})
14:25:15.469 [DEBUG] [com.google.firebase.crashlytics] Using fetched Crashlytics Org Id: xxxxxxxxxxxxxxxxxxxxxxxx for #:############:android:xxxxxxxxxxxxxxxx
主库符号已上传
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] POST file: <BUILD_PATH>\crashlytics\AppNameDebug\nativeSymbols\main-armv7-084400b7e721bf5dd66c8c5877626739802bc470.cSYM.gz to URL: https://cm.crashlytics.com/api/v3/platforms/android/code_mappings
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] POST params:
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] project[identifier] = package.name
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] code_mapping[executables][][arch] = armv7
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] code_mapping[type] = csym
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] code_mapping[executables][][identifier] = 084400b7e721bf5dd66c8c5877626739802bc470
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] POST headers:
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-ORG-ID = xxxxxxxxxxxxxxxxxxxxxxxx
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-DEVELOPER-TOKEN = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] User-Agent = crashlytics-gradle/2.0.0-beta02
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-TYPE = crashlytics-gradle
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-VERSION = 2.0.0-beta02
14:25:27.780 [DEBUG] [com.google.firebase.crashlytics] POST response: [reqId=671299695985d1282834f3b17cc7375966ed349acfb42410] 202
14:25:27.781 [DEBUG] [com.google.firebase.crashlytics] Crashlytics symbol file uploaded successfully; deleting local csym: <BUILD_PATH>\crashlytics\AppNameDebug\nativeSymbols\main-armv7-084400b7e721bf5dd66c8c5877626739802bc470.cSYM
SDL 库符号已上传
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] POST file: <BUILD_PATH>\crashlytics\AppNameDebug\nativeSymbols\SDL2-armv7-7d36271372e5e78fdb06018f776f944d0761b6f9.cSYM.gz to URL: https://cm.crashlytics.com/api/v3/platforms/android/code_mappings
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] POST params:
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] project[identifier] = package.name
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] code_mapping[executables][][arch] = armv7
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] code_mapping[type] = csym
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] code_mapping[executables][][identifier] = 7d36271372e5e78fdb06018f776f944d0761b6f9
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] POST headers:
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-ORG-ID = xxxxxxxxxxxxxxxxxxxxxxxx
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-DEVELOPER-TOKEN = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] User-Agent = crashlytics-gradle/2.0.0-beta02
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-TYPE = crashlytics-gradle
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-VERSION = 2.0.0-beta02
14:25:31.199 [DEBUG] [com.google.firebase.crashlytics] POST response: [reqId=ed1547538ba4ccc96747c9b2c4d3900fcb604606713e293f] 202
14:25:31.199 [DEBUG] [com.google.firebase.crashlytics] Crashlytics symbol file uploaded successfully; deleting local csym: <BUILD_PATH>\crashlytics\AppNameDebug\nativeSymbols\SDL2-armv7-7d36271372e5e78fdb06018f776f944d0761b6f9.cSYM
我发现的唯一奇怪的事情是这一行
14:18:56.974 [DEBUG] [com.google.firebase.crashlytics] Mapping File Upload Enabled: false; id: 00000000000000000000000000000000
...但紧随其后的是这个,所以我认为这不重要
14:18:57.013 [DEBUG] [com.google.firebase.crashlytics] Crashlytics native symbol uploading enabled: true
Firebaser/Crashlytics 团队:要查看 Firebase Crashlytics NDK SDK 的调试输出,我建议您尝试以下操作:
./gradlew app:yourCustomTask --console=plain --debug | grep "\[com.google.firebase.crashlytics\]"
这将显示更多可能有助于您自我解决的输出。
到目前为止,您的设置看起来是正确的,但您的符号文件可能从未生成并从一开始就上传到 Crashlytics。我建议查看此 Firebase 文档,了解如何为剥离和未剥离的本机库提供路径:https://firebase.google.com/docs/crashlytics/ndk-reports-new-sdk。这是文档中的示例:
firebaseCrashlytics {
nativeSymbolUploadEnabled true
strippedNativeLibsDir ‘path/to/stripped/parent/dir’
unstrippedNativeLibsDir ‘path/to/unstripped/parent/dir’
}
如果您仍然遇到问题,请随时将案例提交至 Firebase support,并附上上面的日志和所有相关的 Firebase + Crashlytics 设置信息,以进行更深入的调查。
已解决
通过 uploadCrashlyticsSymbolFileRelease 完成 transformNativeLibsWithStripDebugSymbolForRelease 任务解决了这个问题
在我们更新到新的 SDK 之前它工作正常,现在它只在报告中显示最后一个 java 堆栈帧。任务 uploadCrashlyticsSymbolFileFlavorDebug 在 externalNativeBuildFlavorDebug 之后立即被调用,但报告中没有符号。我在构建后通过 cli 尝试 运行 它,但仍然没有运气。我没主意了,找不到我哪里出错了
项目级 build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:perf-plugin:1.3.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta02'
}
}
应用程序级 build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.firebase-perf'
android {
buildTypes {
release {
debuggable false
firebaseCrashlytics {
nativeSymbolUploadEnabled true
}
}
debug {
debuggable true
firebaseCrashlytics {
nativeSymbolUploadEnabled true
}
}
}
}
dependencies {
implementation 'com.google.firebase:firebase-analytics:17.2.3'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'
implementation 'com.google.firebase:firebase-crashlytics-ndk:17.0.0-beta01'
}
afterEvaluate {
android.applicationVariants.all { variant ->
tasks."externalNativeBuild${variant.name.capitalize()}".finalizedBy "uploadCrashlyticsSymbolFile${variant.name.capitalize()}"
}
}
我还从 onCreate
中删除了以下行Fabric.with(this.spawner, new Crashlytics(), new CrashlyticsNdk());
编辑 1 我检查了调试日志,看看是否一切正常,似乎是:
生成符号
14:24:44.950 [DEBUG] [com.google.firebase.crashlytics] Generating symbols for <BUILD_PATH>\intermediates\ndkBuild\appName\debug\obj\local\armeabi-v7a\libmain.so
14:24:44.950 [DEBUG] [com.google.firebase.crashlytics] Using DWARF data for cSYM generation.
14:25:14.992 [DEBUG] [com.google.firebase.crashlytics] Generating symbols for <BUILD_PATH>\intermediates\ndkBuild\appName\debug\obj\local\armeabi-v7a\libSDL2.so
14:25:14.992 [DEBUG] [com.google.firebase.crashlytics] Using DWARF data for cSYM generation.
已找到 AppId 和 Crashlytics 组织 ID
14:25:15.109 [DEBUG] [com.google.firebase.crashlytics] Getting appId from output of the Google Services plugin at <BUILD_PATH>\generated\res\google-services\appName\debug\values\values.xml
14:25:15.139 [DEBUG] [com.google.firebase.crashlytics] Found Google appId: #:############:android:xxxxxxxxxxxxxxxx
14:25:15.140 [DEBUG] [com.google.firebase.crashlytics] Uploading native symbol files from directory: <BUILD_PATH>\crashlytics\AppNameDebug\nativeSymbols
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] Requesting Legacy Crashlytics settings for #:############:android:xxxxxxxxxxxxxxxx from: http://firebase-settings.crashlytics.com/spi/v2/gmp/#:############:android:xxxxxxxxxxxxxxxx/fabric_ids
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] Request Headers:
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-DEVELOPER-TOKEN : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] User-Agent : crashlytics-gradle/2.0.0-beta02
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-TYPE : crashlytics-gradle
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-VERSION : 2.0.0-beta02
14:25:15.144 [DEBUG] [com.google.firebase.crashlytics] Accept : application/json
14:25:15.147 [DEBUG] [com.google.firebase.crashlytics] REQUEST: http://firebase-settings.crashlytics.com/spi/v2/gmp/#:############:android:xxxxxxxxxxxxxxxx/fabric_ids
14:25:15.469 [DEBUG] [com.google.firebase.crashlytics] RESPONSE: 200 [reqId=null]
14:25:15.469 [DEBUG] [com.google.firebase.crashlytics] Crashlytics settings response: Optional.of({"fabric_org_external_id":"xxxxxxxxxxxxxxxxxxxxxxxx","collector_endpoint":1,"fabric_app_external_id":"xxxxxxxxxxxxxxxxxxxxxxxx","fabric_bundle_id":"package.name"})
14:25:15.469 [DEBUG] [com.google.firebase.crashlytics] Using fetched Crashlytics Org Id: xxxxxxxxxxxxxxxxxxxxxxxx for #:############:android:xxxxxxxxxxxxxxxx
主库符号已上传
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] POST file: <BUILD_PATH>\crashlytics\AppNameDebug\nativeSymbols\main-armv7-084400b7e721bf5dd66c8c5877626739802bc470.cSYM.gz to URL: https://cm.crashlytics.com/api/v3/platforms/android/code_mappings
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] POST params:
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] project[identifier] = package.name
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] code_mapping[executables][][arch] = armv7
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] code_mapping[type] = csym
14:25:23.677 [DEBUG] [com.google.firebase.crashlytics] code_mapping[executables][][identifier] = 084400b7e721bf5dd66c8c5877626739802bc470
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] POST headers:
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-ORG-ID = xxxxxxxxxxxxxxxxxxxxxxxx
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-DEVELOPER-TOKEN = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] User-Agent = crashlytics-gradle/2.0.0-beta02
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-TYPE = crashlytics-gradle
14:25:23.678 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-VERSION = 2.0.0-beta02
14:25:27.780 [DEBUG] [com.google.firebase.crashlytics] POST response: [reqId=671299695985d1282834f3b17cc7375966ed349acfb42410] 202
14:25:27.781 [DEBUG] [com.google.firebase.crashlytics] Crashlytics symbol file uploaded successfully; deleting local csym: <BUILD_PATH>\crashlytics\AppNameDebug\nativeSymbols\main-armv7-084400b7e721bf5dd66c8c5877626739802bc470.cSYM
SDL 库符号已上传
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] POST file: <BUILD_PATH>\crashlytics\AppNameDebug\nativeSymbols\SDL2-armv7-7d36271372e5e78fdb06018f776f944d0761b6f9.cSYM.gz to URL: https://cm.crashlytics.com/api/v3/platforms/android/code_mappings
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] POST params:
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] project[identifier] = package.name
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] code_mapping[executables][][arch] = armv7
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] code_mapping[type] = csym
14:25:29.643 [DEBUG] [com.google.firebase.crashlytics] code_mapping[executables][][identifier] = 7d36271372e5e78fdb06018f776f944d0761b6f9
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] POST headers:
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-ORG-ID = xxxxxxxxxxxxxxxxxxxxxxxx
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-DEVELOPER-TOKEN = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] User-Agent = crashlytics-gradle/2.0.0-beta02
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-TYPE = crashlytics-gradle
14:25:29.644 [DEBUG] [com.google.firebase.crashlytics] X-CRASHLYTICS-API-CLIENT-VERSION = 2.0.0-beta02
14:25:31.199 [DEBUG] [com.google.firebase.crashlytics] POST response: [reqId=ed1547538ba4ccc96747c9b2c4d3900fcb604606713e293f] 202
14:25:31.199 [DEBUG] [com.google.firebase.crashlytics] Crashlytics symbol file uploaded successfully; deleting local csym: <BUILD_PATH>\crashlytics\AppNameDebug\nativeSymbols\SDL2-armv7-7d36271372e5e78fdb06018f776f944d0761b6f9.cSYM
我发现的唯一奇怪的事情是这一行
14:18:56.974 [DEBUG] [com.google.firebase.crashlytics] Mapping File Upload Enabled: false; id: 00000000000000000000000000000000
...但紧随其后的是这个,所以我认为这不重要
14:18:57.013 [DEBUG] [com.google.firebase.crashlytics] Crashlytics native symbol uploading enabled: true
Firebaser/Crashlytics 团队:要查看 Firebase Crashlytics NDK SDK 的调试输出,我建议您尝试以下操作:
./gradlew app:yourCustomTask --console=plain --debug | grep "\[com.google.firebase.crashlytics\]"
这将显示更多可能有助于您自我解决的输出。
到目前为止,您的设置看起来是正确的,但您的符号文件可能从未生成并从一开始就上传到 Crashlytics。我建议查看此 Firebase 文档,了解如何为剥离和未剥离的本机库提供路径:https://firebase.google.com/docs/crashlytics/ndk-reports-new-sdk。这是文档中的示例:
firebaseCrashlytics {
nativeSymbolUploadEnabled true
strippedNativeLibsDir ‘path/to/stripped/parent/dir’
unstrippedNativeLibsDir ‘path/to/unstripped/parent/dir’
}
如果您仍然遇到问题,请随时将案例提交至 Firebase support,并附上上面的日志和所有相关的 Firebase + Crashlytics 设置信息,以进行更深入的调查。
已解决
通过 uploadCrashlyticsSymbolFileRelease 完成 transformNativeLibsWithStripDebugSymbolForRelease 任务解决了这个问题