简体   繁体   中英

Crashlytics Mapping files not getting generated

I have enabled proguard using minifyEnabled true and trying to create build from jenkins. But while creating apk from jenkins I am getting following build error.

> Task :app:packageUat
> Task :app:uploadCrashlyticsMappingFileUat FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:uploadCrashlyticsMappingFileUat'.
> Crashlytics could not find the resource file generated by Google Services. You may need to execute the :process<Variant>GoogleServices Task. Please check your Firebase project configuration (https://firebase.google.com/docs/android/setup). 

I am using FCM and Crashlytics Google services in my application. I have not included google-service.json but initializing runtime. Here is firebase initialization code :

FirebaseApp.initializeApp(mAppContext, new FirebaseOptions.Builder()
            .setProjectId(BuildConfig.PROJECT_ID)
            .setApiKey(BuildConfig.API_KEY)
            .setApplicationId(BuildConfig.FCM_APPLICATION_ID)
            .setGcmSenderId(BuildConfig.GCM_SENDER_ID)
            .build());

    FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);

Following command I am using on jenkins to create build :

clean
assemble${Build}

Here is my uat build configuration :

uat {
        minifyEnabled true
        shrinkResources true
        signingConfig signingConfigs.uat
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        buildConfigField "String", 'API_KEY', API_KEY
        buildConfigField "String", 'FCM_APPLICATION_ID', FCM_APPLICATION_ID
        buildConfigField "String", 'PROJECT_ID', PROJECT_ID
        buildConfigField "String", 'GCM_SENDER_ID', GCM_SENDER_ID

    }

I can not include google-service.json in my project because of security issue. Is there anything I am missing?

It clearly tells you that it expects it in the res directory:

Crashlytics could not find the resource file generated by Google Services.

The XML file would look alike this ... but why not simply provide google-services.json at build time? This is probably less effort than generating the XML file from environmental variables (which is basically nothing else than the plugin does).

And actually... the documentation reads:

The Firebase config file contains unique, but non-secret identifiers for your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM