Flutter项目运行报错 A problem occurred configuring root project ‘android‘. 解决方法

报错如下

* Error running Gradle:
ProcessException: Process "C:\Users\shunyue\mydemo\flutter_app\android\gradlew.bat"
Starting a Gradle Daemon (subsequent builds will be faster)


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.

Flutter项目运行报错 A problem occurred configuring root project ‘android‘. 解决方法_第1张图片

解决方法如下:

找到项目内android文件夹内的build.gradle文件
如下图所示,添加两个mavenCentral()
Flutter项目运行报错 A problem occurred configuring root project ‘android‘. 解决方法_第2张图片
还是不行的话就只给上面一个添加mavenCentral()

最后将手机连接电脑并打开手机USB调试
接下来我们再次运行看看:
Flutter项目运行报错 A problem occurred configuring root project ‘android‘. 解决方法_第3张图片
好啦,成功啦!

你可能感兴趣的:(Flutter,安卓,android)