Reputation: 5905
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?
Upvotes: 3
Views: 383
Reputation: 76779
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.
Upvotes: 1