在使用Flutter进行开发是遇到这样一个问题
Finished with error: ProcessException: Process "D:FlutterAPPflutter_appfiveandroidgradlew.bat" exited abnormally: Exception in thread "main" java.lang.NullPointerException at org.gradle.wrapper.BootstrapMainStarter.findLauncherJar(BootstrapMainStarter.java:34) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:25) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61) Command: D:FlutterAPPflutter_appfiveandroidgradlew.bat -v
网上查了一下说
问题原因:flutter 需要梯子在jcenter和google库里下载依赖,因为google被墙访问不到,所以会在那里一直处于下载状态,但又下载不了。
解决方法:有两个地方需要添加的内容:
maven{ url 'https://maven.aliyun.com/repository/google' }
maven{ url 'https://maven.aliyun.com/repository/jcenter' }
maven{url 'http://maven.aliyun.com/nexus/content/groups/public'}
参考地址:https://blog.csdn.net/generallizhong/article/details/94734937
但是我添加之后还是会报同样的错误
后来修改 gradle-wrapper.properties中的
distributionUrl=https://services.gradle.org/distributions/gradle-4.10.2-all.zip
改为:
distributionUrl=https://services.gradle.org/distributions/gradle-5.4.1-all.zip
再运行就OK了
当然我的Flutter的SDK里面还是配置了上面的了