Amplitude-Flutter
Amplitude-Flutter copied to clipboard
Flutter app fails for release after adding amplitude package
Hi we added amplitude on existing flutter app. it works fine when we run debug mode on emulator. but running release mode is crashing app on start even without implementing and only adding amplitude_flutter dependency without implementing it causes the same issue.
Another issue is after adding when we try to build copy of build folder is created under android/app/.. folder. has been while tiring to fix but no luck.
any help is appreciated
@mikerashoo Thank you for submitting issues here. Is there any log or info about the crashing? We'll look into the problem. Any additional information would be helpful.
@bohan-amplitude I'm running into the same issue with the amplitude_flutter package causing the Android release build to fail. I've copied the error message below. I’m using amplitude_flutter: 3.10.0 and Flutter 3.0.5. Please let me know if there's any other information I can provide that would be helpful.
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)
Hi @sarlow, can you also provide the following info?
1.run flutter build apk --release -v
and return the verbose log
2. provide pubspec.yaml file
3. provide build.gradle file
4. provide gradle.properties file.
Hi @yuhao900914, thanks for following up. After updating the android/gradle/wrapper/gradle-wrapper.properties
distributionUrl and the android/build.gradle
classpath, it seems to be working now, so possibly it was an issue with using an older Gradle version.
Thanks, @sarlow. Do you mind to share the changes in gradle-wrapper.properties
and android/build.gradle
?
Sure, the changes were:
gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-7.0.2-all.zip =>
distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-all.zip
android/build.gradle
classpath 'com.android.tools.build:gradle:7.0.4' =>
classpath 'com.android.tools.build:gradle:7.2.1'
Thanks!