1

I get this error when I try to execute my app on a phone through Android Studio. I tried running flutter clean but it didn't work

 FAILURE: Build failed with an exception.

 * What went wrong:
  Execution failed for task ':app:mergeDexDebug'.
 > A failure occurred while executing 
   com.android.build.gradle.internal.tasks.Workers$ActionFacade
 > com.android.builder.dexing.DexArchiveMergerException: Error while 
 merging dex archives: 
 The number of method references in a .dex file cannot exceed 64K.
 Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

 * 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 2m 44s
 [!] 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 assembleDebug failed with exit code 1

Does someone know how to help me?

1
  • I think its related to multidex. I think you can find solution here Commented Mar 29, 2022 at 10:31

1 Answer 1

0

The best way to go fix these errors is to run the following commands:

  1. flutter clean
  2. flutter build appbundle --no-sound-null-safety

If the issue persists try running -info after the commands then read the logs, it will give you leads to find out the problem.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.