Android应用Crashlytics无法显示C++原生符号,此前正常
Android Crashlytics 原生C++符号不显示问题求助
我的Android/Java应用包含原生C库,此前Crashlytics的原生崩溃报告能正常解析并显示C符号,但在某次升级Gradle、Crashlytics等依赖后,符号突然无法正常显示。
我已经按照Crashlytics官方文档重新配置了项目(没有从零新建项目),所有配置细节都逐一核对过,问题仍然存在。
目前Google Play Console可以正常显示符号,且Build ID与应用一致,但Play Console的崩溃排查体验远不如Crashlytics;另外,旧版本应用的崩溃报告依然能正常显示C++符号,说明不是服务端的问题。
我尝试过调整unstrippedNativeLibsDir参数,不管有没有设置这个参数,结果都没有变化。
以下是我的应用级和全局build.gradle代码:
应用级 build.gradle
plugins { id 'com.android.application' id 'com.google.gms.google-services' // Google services Gradle plugin (for Crashlytics and maybe smth else) id 'com.google.firebase.crashlytics' } android { compileSdk 34 ndkVersion "27.1.12297006" buildToolsVersion = '35.0.0' compileOptions { sourceCompatibility 11 targetCompatibility 11 } namespace 'com.Me.MyApp' buildFeatures { viewBinding = true buildConfig = true } def appVersionCode = 100 defaultConfig { applicationId "com.Me.MyApp" versionCode appVersionCode versionName appVersionCode minSdkVersion 21 minSdkVersion 21 targetSdkVersion android.compileSdk externalNativeBuild { cmake { cppFlags "-std=c++20 -frtti -fexceptions -fvisibility=hidden -fvisibility-inlines-hidden -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR -D_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS -Wno-register -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer" cFlags "-Wno-deprecated-register -funwind-tables -fvisibility=hidden -fvisibility-inlines-hidden -Wno-register -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wno-deprecated-declarations -Wno-exceptions -Wno-unused-value" arguments "-DANDROID_STL=c++_static", "-DANDROID_ARM_MODE=arm", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON" } } resourceConfigurations << 'en' << 'de' << 'es' << 'fr' << 'it' << 'ja' << 'nl' << 'pl' << 'uk' << 'zh' } buildTypes { release { externalNativeBuild { cmake { abiFilters "armeabi-v7a","arm64-v8a","x86_64" cppFlags "-O3 -mllvm -polly" cFlags "-O3 -mllvm -polly" } } minifyEnabled = false ndk { debugSymbolLevel 'FULL' } signingConfig signingConfigs.release firebaseCrashlytics { nativeSymbolUploadEnabled true applicationVariants.all { variant -> firebaseCrashlytics { unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib/${variant.name}/' } } } } debug { externalNativeBuild { cmake { abiFilters "arm64-v8a", "x86_64" cppFlags "-O0 -D_DEBUG=1" cFlags "-O0 -D_DEBUG=1" } } minifyEnabled = false } } externalNativeBuild { cmake { path "CMakeLists.txt" } } } repositories { google() mavenCentral() } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.google.android.material:material:1.12.0' implementation 'androidx.constraintlayout:constraintlayout:2.2.0' implementation 'androidx.documentfile:documentfile:1.0.1' implementation "com.android.billingclient:billing:7.1.1" implementation 'com.google.firebase:firebase-crashlytics-ndk:19.2.1' implementation 'com.google.firebase:firebase-analytics:22.1.2' }
全局 build.gradle
plugins { id 'com.android.application' version '8.7.2' apply false id 'com.google.gms.google-services' version '4.4.2' apply false id 'com.google.firebase.crashlytics' version '3.0.2' apply false } allprojects { repositories { google() mavenCentral() } tasks.withType(JavaCompile).tap { configureEach { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } } } tasks.register('clean', Delete) { delete rootProject.layout.buildDirectory }
希望能得到有效的解决方案。
内容的提问来源于stack exchange,提问作者Violet Giraffe
相关产品推荐
相关产品推荐

