错误: 找不到或无法加载主类 worker.org.gradle.process.internal.worker.GradleWorkerMain
原因: java.lang.ClassNotFoundException: worker.org.gradle.process.internal.worker.GradleWorkerMain
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':gradle:compileGroovy'.
> Failed to run Gradle Worker Daemon
> Process 'Gradle Worker Daemon 2' finished with non-zero exit value 1
* 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
BUILD FAILED in 43s
Running Gradle task 'assembleDebug'..
通过 Android Studio 创建的flutter项目,android/gradle/wrapper/gradle-wrapper.properties
文件的配置
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
将默认的 地址 换成阿里云的MacPorts镜像:
访问/macports/distfiles/gradle/ 目录,我选择的是 gradle-8.7-all.zip
版本
解决方案,将上面的distributionUrl
换成下面的即可:
distributionUrl=https://mirrors.aliyun.com/macports/distfiles/gradle/gradle-8.7-bin.zip
然后重新run
,需要等待很长时间,起码有半个小时以上,手机上就可以运行了。
此时项目里就生成了 8.7版本的 gradle
文件夹
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。