最近在玩Ionic,今天在家里配环境,搞个Sample都build不起来,各种错误。
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> A problem occurred configuring project ':CordovaLib'.
> Could not resolve all dependencies for configuration ':CordovaLib:classpath
'.
> Could not download artifact 'lint-checks.jar (com.android.tools.lint:lin
t-checks:24.0.0)'
> Could not HEAD 'https://repo1.maven.org/maven2/com/android/tools/lint
/lint-checks/24.0.0/lint-checks-24.0.0.jar'.
> peer not authenticated
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 1 mins 9.638 secs
F:\ionic\myApp\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "F:\ionic\myApp\platforms\android
\gradlew cdvBuildDebug -b F:\ionic\myApp\platforms\android\build.gradle -Dorg.gr
adle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
根据提示,又是GWF。。。。。。
只好将gradle加上国内的源
修改文件myApp\platforms\android\build.gradle
repositories {
mavenCentral()
}
替换为
repositories {
maven { url 'http://maven.oschina.net/content/groups/public/' }
}
这是为单独工程变为国内源,当然也可以直接为所有工程设置源:
在.gradle工程下创建init.gradle文件
allprojects{
repositories {
maven {
url "http://maven.oschina.net/content/groups/public"
}
}
}
Build Successful