0

After upgrading Flutter from 1.9.7 to v1.12.13+hotfix.5 my application build failed. I got the following exception:

[ +124 ms] > Task :draw:compileFossDebugSources UP-TO-DATE
[   +5 ms] > Task :draw:assembleFossDebug UP-TO-DATE
[ +136 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
[        ] Use '--warning-mode all' to show the individual deprecation warnings.
[        ] See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
[        ] BUILD SUCCESSFUL in 5m 30s
[        ] 396 actionable tasks: 16 executed, 380 up-to-date
[ +529 ms] Running Gradle task 'assembleFossDebug'... (completed in 331.1s, longer than expected)
[  +35 ms] "flutter run" took 332,133ms.
Gradle build failed to produce an .apk file. It's likely that this file was generated under C:\flutter_projects\my_branch\iamflexi_app\build, but the tool couldn't find it.

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      _exitWithExpectedFileNotFound (package:flutter_tools/src/android/gradle.dart:827:3)
#2      findApkFiles (package:flutter_tools/src/android/gradle.dart:765:5)
#3      buildGradleApp (package:flutter_tools/src/android/gradle.dart:451:35)
#4      _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:73:64)
#5      _rootRunUnary (dart:async/zone.dart:1134:38)
#6      _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#7      _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#8      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#9      Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#10     Future._completeWithValue (dart:async/future_impl.dart:524:5)
#11     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:32:15)
#12     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:290:13)
#13     _DefaultProcessUtils.stream (package:flutter_tools/src/base/process.dart)
#14     _asyncThenWrapperHelper.<anonymous closure> (dart:async-patch/async_patch.dart:73:64)
#15     _rootRunUnary (dart:async/zone.dart:1134:38)
#16     _CustomZone.runUnary (dart:async/zone.dart:1031:19)
#17     _FutureListener.handleValue (dart:async/future_impl.dart:139:18)
#18     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:680:45)
#19     Future._propagateToListeners (dart:async/future_impl.dart:709:32)
#20     Future._completeWithValue (dart:async/future_impl.dart:524:5)
#21     Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:554:7)
#22     _rootRun (dart:async/zone.dart:1126:13)
#23     _CustomZone.run (dart:async/zone.dart:1023:19)
#24     _CustomZone.runGuarded (dart:async/zone.dart:925:7)
#25     _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
#26     _microtaskLoop (dart:async/schedule_microtask.dart:43:21)
#27     _startMicrotaskLoop (dart:async/schedule_microtask.dart:52:5)
#28     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:118:13)
#29     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:175:5)

However when i open my application in Android module in Android Studio then it runs fine but when i tried to run with Flutter i got that error.

Kamran
  • 131
  • 2
  • 4
  • 1
    You have upgraded to gradle 6 which doesnt match with others. To see what are deprecated use this: https://stackoverflow.com/questions/51610420/deprecated-gradle-features-were-used-in-this-build-making-it-incompatible-with – Blasanka Dec 22 '19 at 08:08
  • 1
    Also you can downgrade gradle version if you want – Blasanka Dec 22 '19 at 08:09
  • distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip that is my gradle version in gradle-wrapper.properties file and it is working fine in Flutter version 1.9.7 but after I upgrade to Flutter version 1.12 I got that error. – Kamran Dec 22 '19 at 08:18
  • I dont know why but take a look at: https://stackoverflow.com/a/59453116/6658129 – Nine To Four Dec 23 '19 at 11:08
  • see this answer https://stackoverflow.com/a/61347715/11675817 – M Karimi Feb 27 '21 at 11:22
  • and see this link https://stackoverflow.com/a/62794486/11675817 – M Karimi Feb 27 '21 at 11:29

1 Answers1

0

Using Android Studio may prompt you to upgrade the project's settings (i.e. gradle version). A quick fix for this issue is by downgrading to the project's previous gradle version as previously mentioned in the comments. You can also try going through suggestions posted on this GitHub issue thread ahttps://github.com/flutter/flutter/issues/45681 and see if anything works for you.

Omatt
  • 8,564
  • 2
  • 42
  • 144