尝试在离子应用程序中执行构建时出现异常

时间:2016-05-09 14:57:52

标签: android ionic-framework

我在运行命令'ionic build android'时遇到问题,我无法解决。以前运行离子命令'platform android add'。

D:\ionic\hello>ionic build android
Running command: "C:\Program Files (x86)\nodejs\node.exe" D:\ionic\hello\hooks\a
fter_prepare\010_add_platform_class.js D:\ionic\hello
add to body class: platform-android
ANDROID_HOME=C:\android-sdk-win
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_65

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.2.3.
     Required by:
         :android:unspecified
      > Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gr
adle/1.2.3/gradle-1.2.3.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.585 secs
Error: Error code 1 for command: cmd with args: /s,/c,"D:\ionic\hello\platforms\
android\gradlew cdvBuildDebug -b D:\ionic\hello\platforms\android\build.gradle -
Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"

我需要生成一个包以在Android设备上执行测试。 我的build.gradle是:

apply plugin: 'android'

buildscript {
    repositories {
        mavenCentral()
    }

    // Switch the Android Gradle plugin version requirement depending on the
    // installed version of Gradle. This dependency is documented at
    // http://tools.android.com/tech-docs/new-build-system/version-compatibility
    // and https://issues.apache.org/jira/browse/CB-8143
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
   }

// Allow plugins to declare Maven dependencies via build-extras.gradle.
repositories {
    mavenCentral()
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.8'
}

...

我该如何解决?

1 个答案:

答案 0 :(得分:2)

将旧的gradle-1.2.3-all.zip替换为新下载的 https://services.gradle.org/distributions/gradle-2.2.1-all.zip然后再试一次。

可能是C:\ Users \ shashi.gradle \ wrapper \ dists \ gradle-2.2.1-all

中的Gradle文件
相关问题