firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.25k stars 572 forks source link

Build issue when generating Crashlytics symbole files #6139

Closed Thortoco closed 2 weeks ago

Thortoco commented 1 month ago

[REQUIRED] Step 2: Describe your environment

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

When running the command to bundle our application, we get the following error:

> Task :app:generateCrashlyticsSymbolFileAppNameRelease FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:generateCrashlyticsSymbolFileAppNameRelease'.
java.io.IOException: Breakpad symbol generation failed (exit=1), see STDERR

We launch the following command to bundle our application:

./gradlew app:bundleAppNameRelease

This issue happens when trying to bump the firebase BOM from 32.8.1 to 33.1.2. While doing this change we also bump the following dependencies:

lehcar09 commented 1 month ago

Hi @Thortoco, thank you for reaching out. I tried reproducing the issue, however, I did not encounter the error.

This is my build.gradle file:


plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.jetbrains.kotlin.android)
    alias(libs.plugins.google.gms.google.services)
    alias(libs.plugins.google.firebase.crashlytics)
}

android {
    namespace '<name>'
    compileSdk 34

    defaultConfig {
        applicationId "<name>"
        minSdk 24
        targetSdk 34
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            firebaseCrashlytics {
                mappingFileUploadEnabled = true
                nativeSymbolUploadEnabled = true
            }
        }
        debug {
            firebaseCrashlytics {
                mappingFileUploadEnabled = true
                nativeSymbolUploadEnabled = true
            }
        }
    }

    bundle {
        language {
            enableSplit = false
        }
        density {
            enableSplit = true
        }
        abi {
            enableSplit = true
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    externalNativeBuild {
        cmake {
            path file('src/main/cpp/CMakeLists.txt')
            version '3.22.1'
        }
    }
    buildFeatures {
        viewBinding true
    }
}

dependencies {
    implementation libs.androidx.core.ktx
    implementation libs.androidx.appcompat
    implementation libs.material
    implementation libs.androidx.constraintlayout
    implementation libs.firebase.crashlytics

    testImplementation libs.junit
    androidTestImplementation libs.androidx.junit
    androidTestImplementation libs.androidx.espresso.core
}

Did I miss anything?

I'm not sure if it's just a typo error, but, just to note, if you're using Groovy DSL, you should use the firebaseCrashlytics extension. You can check this documentation for reference.

To add, the Crashlytics Gradle v3 plugin (3+) is a major version and modernizes the SDK by dropping support for lower versions of Gradle and the Android Gradle plugin. For more details, you can check this documentation.

Thortoco commented 1 month ago

Hello @lehcar09 thanks for your answer,

The main difference I see between our code is that on our side, we have minifyEnabled set to true in our build.gradle.

For the firebaseCrashlytics, it's not a typo we use configure<CrashlyticsExtension> as it is the recommended way in gradle.kts (as also mentioned in your documentation link).

I will try in an isolated project your setup.

lehcar09 commented 1 month ago

Thank you for the clarification @Thortoco. I set the isMinifyEnabled to true, but, I still wasn't able to encounter the issue.

Screenshot 2024-08-06 at 7 38 32 PM

Can you share with me the Android Gradle plugin you're using?

Thortoco commented 1 month ago

Hello @lehcar09 I am using the 8.3.2 version of the gradle plugin com.android.tools.build:gradle

I just tried with 8.5.0 and I have the same error.

lehcar09 commented 1 month ago

If any chance, can you share an MCVE to help us investigate the issue? If you're unable to provide one, can you try our quickstart app and see if you can reproduce the issue? Thanks!

google-oss-bot commented 1 month ago

Hey @Thortoco. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

cymerio commented 1 month ago

I have the same issue, but only in my CI environment, in my dev machine it works. Downgrading Firebase Crashlytics gradle from 3.0.x to 2.9.9 solves the issue.

Can't share the project, but I'm using:

This is an old project, so the gradle files are in Groovy and use the old plugin application with buildscript. Not using bundles. Native symbol upload is enabled.

My CI env:

My dev machine:

In app/build/crashlytics/appName/dump_syms/ I see that a dump-syms.bin file was generated, but in app/build/crashlytics/appName/nativeSymbols I see only an empty file (libcrashlytics-common.soSOMENUMBERS.tmp).

Thortoco commented 1 month ago

Hello If I can jump on what you said @cymerio the issue also only happens on our CI that is configured as such:

So the same configuration as you for your dev machine but still we have the issue. Could it be something missing on the CI env that would lead to this build issue?

google-oss-bot commented 3 weeks ago

Hey @Thortoco. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 2 weeks ago

Since there haven't been any recent updates here, I am going to close this issue.

@Thortoco if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

Thortoco commented 1 week ago

Hello, after updating our CI to the latest ubuntu LTS 24.04 we don't have the issue anymore.

cymerio commented 4 days ago

Hello again. I have an update. The build failure disappeared when I migrated the Groovy scripts to Kotlin.

And I also have repro steps:

  1. With Android Studio Koala Feature Drop 2024.1.2 (current stable), generate a new project using the new project wizard. Select "No Activity". In the next page of the wizard, in "Build configuration language" choose "Groovy DSL (build.gradle)".
  2. Add this at the bottom of gradle/libs.versions.toml:
    google-services = { id = "com.google.gms.google-services", version = "4.4.2" }
    firebase-crashlytics = { id = "com.google.firebase.crashlytics", version = "3.0.0" }
  3. Add the plugins to the root project's build.gradle:
    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    plugins {
    alias(libs.plugins.android.application) apply false
    alias(libs.plugins.kotlin.android) apply false
    alias(libs.plugins.google.services) apply false         // add this
    alias(libs.plugins.firebase.crashlytics) apply false    // add this
    }
  4. In app/build.gradle, add and apply the plugins, enable nativeSymbolUploadEnabled and add an externalNativeBuild, like this:
    
    plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.google.services)      // add this
    alias(libs.plugins.firebase.crashlytics) // add this
    }

android { // ... buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' firebaseCrashlytics { // add this nativeSymbolUploadEnabled = true // add this } // add this } } externalNativeBuild { // add this cmake { // add this path "src/main/cpp/CMakeLists.txt" // add this } // add this } // add this // ... }

5. Create `app/src/main/cpp/CMakeLists.txt`:

project(test) cmake_minimum_required(VERSION 3.4.1) add_library(mylib SHARED mylib.c)

6. Create `app/src/main/cpp/mylib.c`:

include

void mylib_func() { printf("Hello, World!\n"); }


7. Put the `google-services.json` in `app/src/google-services.json`
8. Run `./gradlew clean assembleRelease uploadCrashlyticsSymbolFileRelease`
(the task that triggers the failure is `uploadCrashlyticsSymbolFileRelease`)

So, basically it's reproduced with the most minimal example that has the build scripts in Groovy and has native code. But it's only triggered in an old system.