Violet Giraffe
Violet Giraffe

Reputation: 33607

Can't get native (C++) symbols to show up in crash reports, but in the past they did

I have an Android/Java app with a native library. At some point the native crash reports started looking like this. Before it did work fine: enter image description here

I don't know when exactly it broke, I'm upgrading Gradle and dependencies (e. g. crashlytics) when I see there's an update, and at some point just noticed the reports don't show symbols anymore.

After that I have opened the Crashlytics docs and completely went through and re-configured the project for Crashlytics as described. Not from scratch as I didn't create a new project from the ground up, but I paid attention to every detail. No change.

The Google Play Console does show symbols correctly, and the build ID is the same. But it's just lackluster compared to Crashlytics.

Meanwhile, I sometimes still get reports from older versions of the app, from the time when it did work, and these reports do show the symbols. So it doesn't seem to be a server-side issue.

Any advice?

Application 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'
}

Global 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
}

P. S. I have experimented with the unstrippedNativeLibsDir variable, in the past it was needed, now it seems to make no difference and can be omitted, I tried both ways - no change.

Upvotes: 2

Views: 99

Answers (0)

Related Questions