Triple-T / gradle-play-publisher

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
MIT License
4.13k stars 341 forks source link

Firebase Crashlytics mapping file not uploaded in v3.0 #859

Closed wezley98 closed 3 years ago

wezley98 commented 4 years ago

Describe the bug

Been seeing this for a while in v3.0 Snapshots, but just thought it was something to do with my build. Looked into it in more detail, and found the the uploadCrashlyticsMappingFileRelease isn't ran when running the publishReleaseBundle task.

I'm not sure if this is an issue with AGP/Crashlytics plugin or that with the new Crashlytics plugin we now need to explicitly run the new mapping task.

Generating a bundle directly from Android Studio Build -> Generate Signed Bundle / APK correctly runs the uploadCrashlyticsMappingFileRelease task as shown in the build logs below.

How To Reproduce

  1. Setup Firebase Crashlytics https://firebase.google.com/docs/crashlytics/upgrade-sdk?platform=android
  2. Upload Bundle using publishReleaseBundle task.
  3. Force a crash in app and the crash reports are obfuscated

Versions

Tasks executed

publishReleaseBundle

Expected behavior

Bundle is created and uploaded, Firebase mapping file is uploaded.

Additional context (if a crash, provide stack trace)

Further investigation shows that creating an App Bundle directly from Android Studio runs the following tasks automatically

> Task :app:preBuild UP-TO-DATE
> Task :app:extractProguardFiles UP-TO-DATE
> Task :app:preReleaseBuild UP-TO-DATE
> Task :app:checkReleaseDuplicateClasses UP-TO-DATE
> Task :app:compileReleaseAidl NO-SOURCE
> Task :app:compileReleaseRenderscript NO-SOURCE
> Task :app:generateReleaseResValues UP-TO-DATE
> Task :app:generateReleaseResources UP-TO-DATE
> Task :app:injectCrashlyticsMappingFileIdRelease
> Task :app:processReleaseGoogleServices UP-TO-DATE
> Task :app:packageReleaseResources
> Task :app:extractDeepLinksRelease UP-TO-DATE
> Task :app:checkReleaseAarMetadata UP-TO-DATE
> Task :app:parseReleaseLocalResources
> Task :app:processReleaseJavaRes NO-SOURCE
> Task :app:writeReleaseApplicationId UP-TO-DATE
> Task :app:analyticsRecordingRelease
> Task :app:mergeReleaseShaders UP-TO-DATE
> Task :app:compileReleaseShaders NO-SOURCE
> Task :app:generateReleaseAssets UP-TO-DATE
> Task :app:mergeReleaseAssets UP-TO-DATE
> Task :app:mergeReleaseJniLibFolders UP-TO-DATE
> Task :app:mergeReleaseNativeLibs UP-TO-DATE
> Task :app:stripReleaseDebugSymbols UP-TO-DATE
> Task :app:collectReleaseDependencies UP-TO-DATE
> Task :app:configureReleaseDependencies UP-TO-DATE
> Task :app:parseReleaseIntegrityConfig UP-TO-DATE
> Task :app:validateSigningRelease UP-TO-DATE
> Task :generateEditForComDotWesleyellisDotNextepisode
> Task :commitEditForComDotWesleyellisDotNextepisode
> Task :app:mergeReleaseResources
> Task :app:processReleaseVersionCodes
> Task :app:generateReleaseBuildConfig UP-TO-DATE
> Task :app:createReleaseCompatibleScreenManifests UP-TO-DATE
> Task :app:processReleaseMainManifest UP-TO-DATE
> Task :app:processReleaseManifest UP-TO-DATE
> Task :app:processReleaseManifestForPackage UP-TO-DATE
> Task :app:generateReleaseRFile UP-TO-DATE
> Task :app:kaptGenerateStubsReleaseKotlin UP-TO-DATE
> Task :app:kaptReleaseKotlin UP-TO-DATE
> Task :app:compileReleaseKotlin UP-TO-DATE
> Task :app:compileReleaseJavaWithJavac UP-TO-DATE
> Task :app:mergeReleaseJavaResource UP-TO-DATE
> Task :app:processApplicationManifestReleaseForBundle UP-TO-DATE
> Task :app:bundleReleaseResources
> Task :app:processReleaseResources
> Task :app:mergeReleaseGeneratedProguardFiles UP-TO-DATE
> Task :app:transformClassesWithAndroidEntryPointTransformForRelease UP-TO-DATE
> Task :app:transformClassesWithFirebasePerformancePluginForRelease UP-TO-DATE
> Task :app:transformClassesWithRealmTransformerForRelease UP-TO-DATE
> Task :app:minifyReleaseWithR8 UP-TO-DATE
> Task :app:l8DexDesugarLibRelease UP-TO-DATE

> Task :app:shrinkReleaseResources
Removed unused resources: Binary resource data reduced from 831KB to 779KB: Removed 6%

> Task :app:buildReleasePreBundle
> Task :app:uploadCrashlyticsMappingFileRelease
> Task :app:packageReleaseBundle
> Task :app:signReleaseBundle
> Task :app:bundleRelease

BUILD SUCCESSFUL in 15s
49 actionable tasks: 15 executed, 34 up-to-date

Build Analyzer results available

Using publishReleaseBundle task

> Task :app:preBuild UP-TO-DATE
> Task :app:extractProguardFiles
> Task :app:preReleaseBuild
> Task :app:compileReleaseAidl NO-SOURCE
> Task :app:compileReleaseRenderscript NO-SOURCE
> Task :app:generateReleaseResValues
> Task :app:generateReleaseResources
> Task :app:injectCrashlyticsMappingFileIdRelease

> Task :app:processReleaseGoogleServices
Parsing json file: /Users/Wez/episode_guide/app/google-services.json

> Task :generateEditForComDotWesleyellisDotNextepisode
> Task :app:packageReleaseResources
> Task :app:checkReleaseDuplicateClasses
> Task :app:extractDeepLinksRelease
> Task :app:generateReleasePlayResources
> Task :app:processReleaseVersionCodes
> Task :app:generateReleaseBuildConfig
> Task :app:createReleaseCompatibleScreenManifests
> Task :app:processReleaseMainManifest
> Task :app:processReleaseManifest
> Task :app:parseReleaseLocalResources
> Task :app:processReleaseJavaRes NO-SOURCE
> Task :app:mergeReleaseShaders
> Task :app:compileReleaseShaders NO-SOURCE
> Task :app:generateReleaseAssets UP-TO-DATE
> Task :app:mergeReleaseAssets
> Task :app:processApplicationManifestReleaseForBundle
> Task :app:mergeReleaseResources
> Task :app:processReleaseManifestForPackage
> Task :app:mergeReleaseJniLibFolders
> Task :app:collectReleaseDependencies
> Task :app:configureReleaseDependencies
> Task :app:validateSigningRelease
> Task :app:generateReleaseRFile
> Task :app:kaptGenerateStubsReleaseKotlin
> Task :app:parseReleaseIntegrityConfig
> Task :app:checkReleaseAarMetadata
> Task :app:mergeReleaseNativeLibs

> Task :app:kaptReleaseKotlin

> Task :app:bundleReleaseResources
> Task :app:processReleaseResources

> Task :app:compileReleaseKotlin

> Task :app:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :app:mergeReleaseGeneratedProguardFiles
> Task :app:transformClassesWithAndroidEntryPointTransformForRelease

> Task :app:transformClassesWithFirebasePerformancePluginForRelease
> Task :app:mergeReleaseJavaResource
> Task :app:transformClassesWithRealmTransformerForRelease

> Task :app:minifyReleaseWithR8

> Task :app:shrinkReleaseResources
Removed unused resources: Binary resource data reduced from 876KB to 824KB: Removed 5%

> Task :app:l8DexDesugarLibRelease
> Task :app:buildReleasePreBundle
> Task :app:packageReleaseBundle
> Task :app:signReleaseBundle

> Task :app:publishReleaseBundle
Starting App Bundle upload: /Users/Wez/episode_guide/app/build/outputs/bundle/release/app-release.aab
Uploading App Bundle: 80% complete
App Bundle upload complete
Starting mapping file upload: /Users/Wez/episode_guide/app/build/outputs/mapping/release/mapping.txt
Uploading mapping file: 51% complete
Mapping file upload complete
Updating [completed] release (com.wesleyellis.nextepisode:[836]) in track 'internal'

> Task :commitEditForComDotWesleyellisDotNextepisode
Committing changes

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.6.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 3m 46s
48 actionable tasks: 48 executed
15:33:05: Task execution finished 'publishReleaseBundle'.

Example crash report for version above (836)

Screenshot 2020-09-10 at 13 02 53
wezley98 commented 4 years ago

Also worth mentioning that the same Firebase versions worked correctly with AS v4.0.1 and gradle-play-publisher v2.8.0, and the mapping files were uploaded correctly.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

SUPERCILEX commented 4 years ago

Ah, sorry for not replying. This plugin has nothing to do with crashlytics, so you'd have to set up the wiring yourself. That said, I think this it's a decent feature request that wouldn't be too hard to implement.

b95505017 commented 4 years ago

Sorry, but why using bundleRelease works but publishReleaseBundle? Which means v3 broke original release flow. Does it means that we have to call uploadCrashlyticsMappingFileRelease manually in v3?

SUPERCILEX commented 4 years ago

We never did anything with crashlytics. I'm guessing you have something manual configured in your build files using the old task names.

b95505017 commented 4 years ago

@SUPERCILEX I didn't do anything special and the difference is clearly by executing ./gradlew --dry-run bundleRelease v.s. ./gradlew --dry-run publishReleaseBundle to any sample. The later one doesn't execute uploadCrashlyticsMappingFileRelease.

SUPERCILEX commented 4 years ago

Maybe the crashlytics plugin sets that up for you? We're using new APIs which means that task doesn't run AFAIK.

chrisbanes commented 4 years ago

I've also hit this. I'm not 100% sure, but I think the Crashlytics plugin is hooking up their uploadCrashlyticsMappingFileRelease task to depend explicitly on bundleRelease. Since bundleRelease is no longer run by publishReleaseBundle, the mapping task isn't being run, so it's not being uploaded.

Easy workaround for now, just call both when publishing: ./gradlew bundleRelease publishRelease

You could also probably hook it this up automatically in Gradle, but that feels overkill.

b95505017 commented 4 years ago

Currently my workaround is gradlew publishReleaseBundle uploadCrashlyticsMappingFileRelease

ghost commented 4 years ago

I get an issue with the process uploadCrashlyticsMappingFileRelease not completing at all. I just use the normal assembleRelease command (not even publishing it).

android tools plugin version: 3.5.3
kotlin version: 1.4.10
gradle-wrapper: 6.6.1

crashlytics plugin: com.google.firebase:firebase-crashlytics-gradle:2.1.0

could the version of crashlytics be a reason why this is happening?

vladimirov001 commented 4 years ago

Currently my workaround is gradlew publishReleaseBundle uploadCrashlyticsMappingFileRelease

Thanks, it helps

galonga commented 4 years ago

Same issue here, firebase crashreports are incomplete. Will try to use the workaround for now.

nicandris commented 3 years ago

Just an addition to this

~/workspace/app [master]:$ ./gradlew --dry-run assembleRelease | grep rash
:app:injectCrashlyticsMappingFileIdRelease SKIPPED
:app:uploadCrashlyticsMappingFileRelease SKIPPED

 ~/workspace/app [master]:$ ./gradlew --dry-run publishReleaseApk | grep rash
:app:injectCrashlyticsMappingFileIdRelease SKIPPED

 ~/workspace/app [master]:$ 
nicandris commented 3 years ago

Can someone confirm that this is fixed? I still dont see the upload task in /gradlew --dry-run publishRelease

mochadwi commented 3 years ago

Have you tried to update v3.2.0? @nicandris

nicandris commented 3 years ago

I didnt push a release yet, but i updated to 3.2.0 now and:

 $ ./gradlew --dry-run assembleRelease | grep rash
:app:injectCrashlyticsMappingFileIdRelease SKIPPED
:app:uploadCrashlyticsMappingFileRelease SKIPPED

  $ ./gradlew --dry-run publishRelease | grep rash
:app:injectCrashlyticsMappingFileIdRelease SKIPPED
  $ 
mochadwi commented 3 years ago

903 might be related and looks like we've to manually run the upload mappings task manually as suggested on the above comments

I've also update the v3.2.0 and also use manual task for now

SUPERCILEX commented 3 years ago

Does the same thing happen if you run publishApk directly?