2016-05-09 38 views
1

我遇到了運行命令'ionic build android'的問題,但無法解決。以前運行ionic命令'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' 
} 

...

我怎樣才能解決?

+0

嗯,不知道,但要確保構建工具,你到今天爲止,也使確定安裝了「extras」。請確保你已連接到互聯網:)嘗試使用--stacktrace標誌運行併發布輸出。 – iCediCe

+0

感謝@iCediCe,因爲我在根文件夾中的jre/jdk中使用了一個證書,而且這個證書已過期,所以我不能下載任何東西。 – phdias

+0

沒問題,很高興聽到你讓它工作。 – iCediCe

回答

相關問題