Corodva Could not resolve com.android.tools.build:gradle:3.0.0 解决方法
使用 cordova run android 运行时,出现错误
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not HEAD 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> dl.google.com
搜索了很久,大部门的解决方案都是在repositories中加入google(),实际并没有用。
后来想到可能是网络问题,于是将 android/build.gradle android/app/build.gradle android/CordovaLib/build.gradle中 的所有 repositories改为
repositories {
jcenter()
maven {
url "http://maven.aliyun.com/nexus/content/groups/public/"
}
}
然后就可以了。。。
本文介绍了解决 Cordova 在运行 Android 应用时出现的错误:无法解析 com.android.tools.build:gradle:3.0.0 的方法。通过修改 build.gradle 文件中的资源仓库地址为阿里云 Nexus 仓库,成功解决了网络问题导致的资源无法获取。
2351

被折叠的 条评论
为什么被折叠?



