运行 flutter build appbundle时,出现以下错误:Gradle构建无法生成Android捆绑包。
flutter build appbundle
当以详细模式运行时,这是我另外得到的:
#0 throwToolExit (package:flutter_tools/src/base/common.dart:24:3) #1 _buildGradleProjectV2 (package:flutter_tools/src/android/gradle.dart:585:7) <asynchronous suspension> #2 buildGradleProject (package:flutter_tools/src/android/gradle.dart:331:14) <asynchronous suspension> #3 buildAppBundle (package:flutter_tools/src/android/app_bundle.dart:43:10) <asynchronous suspension> #4 BuildAppBundleCommand.runCommand (package:flutter_tools/src/commands/build_appbundle.dart:43:11) <asynchronous suspension> #5 FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:545:18) #6 _asyncThenWrapperHelper.<anonymous closure> (dart:async/runtime/libasync_patch.dart:77:64) #7 _rootRunUnary (dart:async/zone.dart:1132:38) #8 _CustomZone.runUnary (dart:async/zone.dart:1029:19) #9 _FutureListener.handleValue (dart:async/future_impl.dart:126:18) #10 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:639:45) #11 Future._propagateToListeners (dart:async/future_impl.dart:668:32) #12 Future._complete (dart:async/future_impl.dart:473:7) #13 _SyncCompleter.complete (dart:async/future_impl.dart:51:12) #14 _AsyncAwaitCompleter.complete.<anonymous closure> (dart:async/runtime/libasync_patch.dart:33:20) #15 _rootRun (dart:async/zone.dart:1124:13) #16 _CustomZone.run (dart:async/zone.dart:1021:19) #17 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:947:23) #18 _microtaskLoop (dart:async/schedule_microtask.dart:41:21) #19 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5) #20 _runPendingImmediateCallback (dart:isolate/runtime/libisolate_patch.dart:115:13) #21 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:172:5)
我在Flutter稳定频道v1.2.1上。
我可以毫无问题地构建apk。我还可以从另一个Flutter项目构建一个appbundle。
根据以上错误消息,您将如何开始查找问题?这可能是什么问题?
我有相同的错误消息类似的问题。(成功创建APK版本,但未能构建应用捆绑包)对我有效的解决方案是升级Android Gradle版本。以下是适用于我的配置(您也可以升级到最新版本):
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' }
}