Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter app fails for release after adding amplitude package #117

Closed
mikerashoo opened this issue Aug 25, 2022 · 7 comments
Closed

Flutter app fails for release after adding amplitude package #117

mikerashoo opened this issue Aug 25, 2022 · 7 comments

Comments

@mikerashoo
Copy link

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

@bohan-amplitude
Copy link

@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.

@sarlow
Copy link

sarlow commented Sep 7, 2022

@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)

#2 AndroidGradleBuilder.buildApk (package:flutter_tools/src/android/gradle.dart:184:5)

#3 AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:577:7)

#4 FlutterDevice.runCold (package:flutter_tools/src/resident_runner.dart:505:33)

#5 ColdRunner.run (package:flutter_tools/src/run_cold.dart:71:28)

#6 RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:692:26)

#7 FlutterCommand.run. (package:flutter_tools/src/runner/flutter_command.dart:1183:27)

#8 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#9 CommandRunner.runCommand (package:args/command_runner.dart:209:13)

#10 FlutterCommandRunner.runCommand. (package:flutter_tools/src/runner/flutter_command_runner.dart:281:9)

#11 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#12 FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:229:5)

#13 run.. (package:flutter_tools/runner.dart:62:9)

#14 AppContext.run. (package:flutter_tools/src/base/context.dart:150:19)

#15 main (package:flutter_tools/executable.dart:94:3)

@yuhao900914
Copy link
Contributor

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.

@sarlow
Copy link

sarlow commented Sep 21, 2022

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.

@yuhao900914
Copy link
Contributor

Thanks, @sarlow. Do you mind to share the changes in gradle-wrapper.properties and android/build.gradle?

@sarlow
Copy link

sarlow commented Sep 21, 2022

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'

@yuhao900914
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants