Flutter:Gradle任务assembleDebug失败,退出代码为1

时间:2019-09-02 11:40:54

标签: android flutter

因此,我使用Flutter开发了一个应用程序,它甚至已发布到Playstore。最近,我正在进行更新,但由于错误,我添加了一个不支持AndroidX的插件(interactive_webview)。看到错误后,我删除了该插件并进行了清理。但是从那以后,我得到了这个错误:

Launching lib\main.dart on RMX1801 in debug mode...
Launching lib/main.dart on RMX1801 in debug mode...
Initializing gradle...                                              0.7s
Resolving dependencies...                                           5.0s
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        20.3s
Gradle task assembleDebug failed with exit code 1
  
      
  • 几个月前,我已经迁移到AndroidX。
  •   
  • 我正在使用最新版的flutter。
  •   
  • 应用的已编译且有针对性的SDK为28。

  •   
  • gradle-wrapper.properties具有distributionUrl = https://services.gradle.org/distributions/gradle-5.1.1-all.zip

  •   

flutter运行-v错误:

[   +1 ms] 255 actionable tasks: 6 executed, 249 up-to-date
[ +518 ms] Running Gradle task 'assembleDebug'... (completed in 9.9s)
[   +6 ms] "flutter run" took 16,722ms.
[   +1 ms] "flutter run" took 16,722ms.
Gradle task assembleDebug failed with exit code 1

#0      throwToolExit (package:flutter_tools/src/base/common.dart:28:3)
#1      _buildGradleProjectV2 (package:flutter_tools/src/android/gradle.dart:507:5)
<asynchronous suspension>
#2      buildGradleProject (package:flutter_tools/src/android/gradle.dart:346:14)
<asynchronous suspension>
#3      buildApk (package:flutter_tools/src/android/apk.dart:34:9)
<asynchronous suspension>
#4      AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:426:13)
<asynchronous suspension>
#5      FlutterDevice.runHot (package:flutter_tools/src/resident_runner.dart:371:54)
<asynchronous suspension>
#6      HotRunner.run (package:flutter_tools/src/run_hot.dart:251:39)
<asynchronous suspension>
#7      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:469:37)
<asynchronous suspension>
#8      FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:478:18)
<asynchronous suspension>
#9      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:383:33)
<asynchronous suspension>
#10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:29)
<asynchronous suspension>
#11     _rootRun (dart:async/zone.dart:1124:13)
#12     _CustomZone.run (dart:async/zone.dart:1021:19)
#13     _runZoned (dart:async/zone.dart:1516:10)
#14     runZoned (dart:async/zone.dart:1463:12)
#15     AppContext.run (package:flutter_tools/src/base/context.dart:152:18)
<asynchronous suspension>
#16     FlutterCommand.run (package:flutter_tools/src/runner/flutter_command.dart:375:20)
#17     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
<asynchronous suspension>
#18     FlutterCommandRunner.runCommand.<anonymous closure>
(package:flutter_tools/src/runner/flutter_command_runner.dart:396:21)
<asynchronous suspension>
#19     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:29)
<asynchronous suspension>
#20     _rootRun (dart:async/zone.dart:1124:13)
#21     _CustomZone.run (dart:async/zone.dart:1021:19)
#22     _runZoned (dart:async/zone.dart:1516:10)
#23     runZoned (dart:async/zone.dart:1463:12)
#24     AppContext.run (package:flutter_tools/src/base/context.dart:152:18)
<asynchronous suspension>
#25     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:356:19)
<asynchronous suspension>
#26     CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#27     new Future.sync (dart:async/future.dart:224:31)
#28     CommandRunner.run (package:args/command_runner.dart:112:14)
#29     FlutterCommandRunner.run (package:flutter_tools/src/runner/flutter_command_runner.dart:242:18)
#30     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:22)
<asynchronous suspension>
#31     _rootRun (dart:async/zone.dart:1124:13)
#32     _CustomZone.run (dart:async/zone.dart:1021:19)
#33     _runZoned (dart:async/zone.dart:1516:10)
#34     runZoned (dart:async/zone.dart:1500:12)
#35     run.<anonymous closure> (package:flutter_tools/runner.dart:60:18)
<asynchronous suspension>
#36     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:29)
<asynchronous suspension>
#37     _rootRun (dart:async/zone.dart:1124:13)
#38     _CustomZone.run (dart:async/zone.dart:1021:19)
#39     _runZoned (dart:async/zone.dart:1516:10)
#40     runZoned (dart:async/zone.dart:1463:12)
#41     AppContext.run (package:flutter_tools/src/base/context.dart:152:18)
<asynchronous suspension>
#42     runInContext (package:flutter_tools/src/context_runner.dart:56:24)
<asynchronous suspension>
#43     run (package:flutter_tools/runner.dart:51:10)
#44     main (package:flutter_tools/executable.dart:62:9)
<asynchronous suspension>
#45     main (file:///C:/Users/Dell/flutter/packages/flutter_tools/bin/flutter_tools.dart:8:3)
#46     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#47     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

颤抖的医生-v:

[√] Flutter (Channel stable, v1.7.8+hotfix.4, on Microsoft Windows [Version 10.0.15063], locale en-US)
    • Flutter version 1.7.8+hotfix.4 at C:\Users\Dell\flutter
    • Framework revision 20e59316b8 (6 weeks ago), 2019-07-18 20:04:33 -0700
    • Engine revision fee001c93f
    • Dart version 2.4.0


[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at C:\Users\Dell\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 33.4.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] VS Code (version 1.37.1)
    • VS Code at C:\Users\Dell\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.3.0

[√] Connected device (1 available)
    • RMX1801 • 8843cc23 • android-arm64 • Android 9 (API 28)

• No issues found!

2 个答案:

答案 0 :(得分:0)

您是否尝试卸载并进行应用的全新安装?

答案 1 :(得分:0)

您是否尝试更新本机android代码文件中的任何代码? 例如:styles.xml或launch_background.xml。该更新或您对该文件所做的更改可能是导致此错误的原因。首先检查一下。