bugsnag-android-gradle-plugin
bugsnag-android-gradle-plugin copied to clipboard
Upload JVM Mapping not working with Proguard 7 plugin on Android
I am testing out the 7.x variant of Bugsnag for use with the new Android Gradle plugin. I get everything to work, except for uploading JVM mappings in combination with Proguard 7 Gradle plugin. Somehow it doesn't detect that mappings are available. I think it's because the new Proguard needs 'minifyEnabled' set to false.
I also tried uploading a mapping manually, but it says:
'uploadBugsnagReleaseMapping' not found in project ':project'. Some candidates are: 'uploadBugsnagNdkReleaseMapping'.
My config:
bugsnag {
uploadJvmMappings = true
uploadNdkMappings = true
overwrite = true
sharedObjectPaths = [new File("../debugSOs/obj")]
}
Am I missing something here? Can I use a workaround?
It seems that this line in the gradle plugin causes the issue:
private fun Project.isJvmMinificationEnabled(variant: BaseVariant) =
variant.buildType.isMinifyEnabled || hasDexguardPlugin()
Hi @peterdk - we're aware of some issues with the latest version of the Android Gradle Plugin, e.g. https://github.com/bugsnag/bugsnag-android-gradle-plugin/issues/462. Could you let us know what versions you're using of the following please?
- Android Studio
- Gradle
- Android Gradle Plugin (AGP)
- Bugsnag Android Gradle Plugin
- Android Studio Chipmunk 2021.2.1
- Gradle 7.4.2
- Android Gradle Plugin 7.2.0 (als tested with 7.1.3 same issue)
- Bugsnag gradle 7.2.0 (also tested with 7.1.0 same issue)
To give some more context:
Proguard is the default implementation for minify in Android, but since Android Gradle 7 or so it now defaults to r8, and no longer can use proguard itself out of the box. Since I need proguard optimization for app performance (tests with r8 lead to less performant app) I added the proguard 'com.guardsquare:proguard-gradle:7.x plugin, which allows for using proguard with the newer AGP.
However, this plugin requires minify to be false, since r8 needs to be disabled. Result is that bugsnag does not see that isJvmMinificationEnabled is true, since the logic doesn't know anything about this proguard plugin and sees minify set to false.
It would be useful if bugsnag detects proguard and enabled the jvm upload, just like it also detects dexguard case. And in the case of proguard it's probably much easier to detect.
Hi @peterdk ,
Thanks for raising this. It does look like a use case we don't currently support for automatic uploads. We are going to look to get this fixed as soon as we can.
In the meantime as a work around you could look to manually upload the mapping.txt files which the Proguard plugin would generate with each build: https://docs.bugsnag.com/api/android-mapping-upload/#for-proguard