finished with error: gradle task assembledebug failed with exit code 1

For making an apk for Android in Flutter this issue in some cases occurs. I had the karma of confronting this issue also. Here are the couple of ways it very well may be tackled:

Because of androidX

Attempt this:

Check with steps in “not suggested” route in above instructional exercise if each recorded documents is same as in your task, particularly :

  • in root/android/gradle/covering/gradle-wrapper.properties set distributionUrl=https\://services.gradle.org/appropriations/gradle-4.10.2-all.zip
  • in root/android/build.gradle, set

conditions { classpath ‘com.android.tools.build:gradle:3.3.2’ }

  • check if in root/android/application/build.gradle SDK form is set to least 28 for:

compileSdkVersion 28 and targetSdkVersion 28

In the event that you actually get blunder, at that point here is the thing that encouraged me:

  • erase .gradle and .m2 organizers from $HOME catalog, also with in application envelopes: root/android/.gradle and root/fabricate
  • vacillate specialist
  • vacillate clean
  • vacillate bundles bar store clean
  • in the event that you changed (as me) application symbol at that point run:

vacillate bundles bar run flutter_launcher_icons:main

it will deliver symbols for application – without it print same mistake with gradle..

  • Negate stores in Android Studio “Record” > “Refute Caches/Restart…”

Macintosh + Android Studio, for my situation generally exceptional, following NOT work:

  • attempt shudder specialist – v yet all climate is OK
  • set android.useAndroidX and android.enableJetifier to valid
  • change android gadget: genuine telephone xiaomi9/emulator Nexus 5/emulator Pixel 2
  • shudder clean
  • change minSdkVersion from 16 to 21
  • erase a few (dubious) dart code

lastly INDEED work by:

reboot my Mac

Thanks for being with us on a Flutter Journey!!!

Leave a Comment