Ionic build android Error code 1

最近在玩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

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

坑爹程序猿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值