I recently added the Amplitude Flutter plugin to my app.
Everything is working perfectly in dev mode, but as soon as I build the app for Android in release mode, the build fails with the errors I’ve copied below.
I’m sure the issue is with the Amplitude plugin, since removing it allows me to build the app in release mode with no problems.
I’m using amplitude_flutter: 3.10.0 and Flutter 3.0.5.Â
---
ERROR:R8: com.android.tools.r8.internal.r8: Attribute Signature requires InnerClasses attribute. Check -keepattributes directive.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:minifyReleaseWithR8'.
> com.android.tools.r8.CompilationFailedException: Compilation failed to complete
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 29s
Running Gradle task 'assembleRelease'... Â Â Â Â Â Â Â Â Â Â Â Â Â 90.6s
┌─ Flutter Fix ──────────────────────────────────────────────────────────────â”
│ â!] The shrinker may have failed to optimize the Java bytecode.       │
│ To disable the shrinker, pass the `--no-shrink` flag to this command.    │
│ To learn more, see: https://developer.android.com/studio/build/shrink-code │
└────────────────────────────────────────────────────────────────────────────┘
Exception: Gradle task assembleRelease failed with exit code 1
#0 Â Â Â throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
#1 Â Â Â AndroidGradleBuilder.buildGradleApp (package:flutter_tools/src/android/gradle.dart:444:7)
<asynchronous suspension>
#2 Â Â Â AndroidGradleBuilder.buildApk (package:flutter_tools/src/android/gradle.dart:184:5)
<asynchronous suspension>
#3 Â Â Â AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:577:7)
<asynchronous suspension>
#4 Â Â Â FlutterDevice.runCold (package:flutter_tools/src/resident_runner.dart:505:33)
<asynchronous suspension>
#5 Â Â Â ColdRunner.run (package:flutter_tools/src/run_cold.dart:71:28)
<asynchronous suspension>
#6 Â Â Â RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:692:26)
<asynchronous suspension>
#7 Â Â Â FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1183:27)
<asynchronous suspension>
#8 Â Â Â AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#9 Â Â Â CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#10 Â Â FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)
<asynchronous suspension>
#11 Â Â AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#12 Â Â FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)
<asynchronous suspension>
#13 Â Â run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
<asynchronous suspension>
#14 Â Â AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
<asynchronous suspension>
#15 Â Â main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>