离子构建后的错误

时间:2016-02-22 17:05:15

标签: cordova ionic-framework

系统 - Ubuntu

我做了以下事情:

.bashrc

export ANDROID_HOME=/root/Android/Sdk

export PATH=$PATH:/root/Android/Sdk/tools

尝试完成上述操作后,我尝试在控制台中运行sudo ionic build android

控制台输出:

sudo ionic build android

Running command: /home/aiduryagin/Desktop/androidDev/test/hooks/after_prepare/010_add_platform_class.js /home/aiduryagin/Desktop/androidDev/test
add to body class: platform-android
ANDROID_HOME=/root/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:1.5.0.
     Required by:
         :android:unspecified
      > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.5.0/gradle-1.5.0.pom'.
         > 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.615 secs
ERROR building one of the platforms: Error code 1 for command: /home/aiduryagin/Desktop/androidDev/test/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/aiduryagin/Desktop/androidDev/test/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /home/aiduryagin/Desktop/androidDev/test/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/aiduryagin/Desktop/androidDev/test/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

1 个答案:

答案 0 :(得分:1)

首先,您不应该使用sudo运行cordova CLI命令,这会导致错误,因为用户运行sudo命令的用户与您的用户不同,因此如果您为用户配置路径,则不会更改sudo用户。

你只需要sudo来运行npm install -g ...命令,但不需要运行cordova或离子命令。

那就是说,这似乎不是你问题的原因。

  

无法获得' https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.5.0/gradle-1.5.0.pom'。   peer未经过身份验证

此消息似乎表明您在尝试下载依赖项时遇到SSL问题。你是代理人还是什么?