Flutter应用程序卡在”app running gradle task ‘assembledebug…”。

huangapple go评论90阅读模式
英文:

Flutter App stuck on "app running gradle task 'assembledebug..."

问题

这是我的第一个Flutter应用程序,我尝试运行Flutter提供的示例,但它卡在这个消息上:running gradle task 'assembledebug....,或者过了一段时间后出现错误:Exception: Gradle task assembleDebug 失败,退出代码为1

尝试了所有在类似问题中提到的方法。使用SDK版本30,Android Studio版本3.1和Flutter版本1.20.1。

> 无法将构件‘x86_debug.jar (io.flutter:x86_debug:1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54)’转换为匹配的属性{artifactType=android-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}。
      > JetifyTransform执行失败:C:\Users\dell\.gradle\caches\modules-2\files-2.1\io.flutter\x86_debug.0.0-c8e3b9485386425213e2973126d6f57e7ed83c540a59b7be41f73458509975d3eefca7ad5561cf\x86_debug-1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54.jar。
         > 无法使用Jetifier转换‘C:\Users\dell\.gradle\caches\modules-2\files-2.1\io.flutter\x86_debug.0.0-c8e3b9485386425213e2973126d6f57e7ed83c540a59b7be41f73458509975d3eefca7ad5561cf\x86_debug-1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54.jar’。原因:ZLIB输入流意外结束。(运行时加上--stacktrace以获取更多详细信息。)

* 尝试:
使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan以获取完整的信息。

* 在https://help.gradle.org获取更多帮助。

<details>
<summary>英文:</summary>

This is my first flutter app I tried running the sample given by the flutter but it gets stuck on this message app ` running gradle task &#39;assembledebug....` or after sometime error `Exception: Gradle task assembleDebug failed with exit code 1` appears.
 Tried doing all the things answered in similar questions. Using sdk version 30, Android studio ver 3.1 and flutter ver 1.20.1. 

> Failed to transform artifact 'x86_debug.jar (io.flutter:x86_debug:1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54)' to match attributes {artifactType=android-classes, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\Users\dell.gradle\caches\modules-2\files-2.1\io.flutter\x86_debug\1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54\570a59b7be41f73458509975d3eefca7ad5561cf\x86_debug-1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54.jar.
> Failed to transform 'C:\Users\dell.gradle\caches\modules-2\files-2.1\io.flutter\x86_debug\1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54\570a59b7be41f73458509975d3eefca7ad5561cf\x86_debug-1.0.0-c8e3b9485386425213e2973126d6f57e7ed83c54.jar' using Jetifier. Reason: Unexpected end of ZLIB input stream. (Run with --stacktrace for more details.)

  • 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

答案1

得分: 3

运行以下命令以查看哪个部分花费了很多时间:

flutter run -v

在我的情况下,它是以下内容:

Downloading https://services.gradle.org/distributions/gradle-7.4-all.zip

如果你遇到相同的问题,查看这个链接

英文:

Run

flutter run -v

so you can see which part is taking much time.
In my case it was
Downloading https://services.gradle.org/distributions/gradle-7.4-all.zip
if you have the same problem check this

答案2

得分: 0

你尝试过使用 flutter clean 进行干净构建吗?另外,你能够贴出更多的错误信息和代码吗?

英文:

have you tried a clean build with flutter clean? and could you also post more of your error and code?

答案3

得分: 0

尝试清空缓存 "C:\Users\dell.gradle\caches" 并重新运行项目。在构建项目时,还应检查事件日志错误。

英文:

Try to empty cache "C:\Users\dell.gradle\caches" and re-run the project. You should also check for Event log error when building the project.

答案4

得分: 0

在你的Android Studio中,进入android目录,然后从终端运行:
gradlew clean
gradlew build
然后运行该应用程序。
如果不起作用,请尝试运行flutter clean。
还要删除用户目录中的.gradle文件夹。
这会花费一些时间,但它将运行。

英文:

In your android studio, cd to android directory then run from terminal:
gradlew clean
gradlew build
and then run the application.
If it wont work try flutter clean.
Also delete the .gradle folder in Users directory.
it will take some time but it will run.

huangapple
  • 本文由 发表于 2020年8月17日 02:34:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/63440628.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定