2017-08-08 168 views
-1

我無法在科爾多瓦建立一個apk。構建總是失敗。「離子科爾多瓦構建」未能建立apk

設置我的Android SDK家

出口ANDROID_HOME /家庭/菲利普/安卓/ SDK/

首先,建立找不到gradle這個,所以我把路徑的gradle。我已經嘗試了下載的gradle或我在android studio中的gradle。

出口PATH = $ PATH:/home/felipe/gradle-4.1/bin

爲了確保我已經更新了科爾多瓦的版本和離子

NPM安裝-g科爾多瓦@最新 NPM安裝-g離子@最新

簡單的示例應用程序

離子開始sidemenu sidemenu --type ionic1

CD sidemenu 離子科爾多瓦平臺添加的Android 離子科爾多瓦構建Android

然後我得到:

> ionic cordova prepare 
    > cordova prepare 
    ✔ Running command - done! 
    Running command: /home/felipe/ionic-testes/sidemenu/hooks/after_prepare/010_add_platform_class.js /home/felipe/ionic-testes/sidemenu 
    add to body class: platform-android 
    > cordova build android 
    ✖ Running command - failed! 

    [ERROR] Cordova encountered an error. 
      You may get more insight by running the Cordova command above directly. 

    [ERROR] An error occurred while running cordova build android (exit code 1): 

      Running command: /home/felipe/ionic-testes/sidemenu/hooks/after_prepare/010_add_platform_class.js 
      /home/felipe/ionic-testes/sidemenu 
      add to body class: platform-android 
      ANDROID_HOME=/home/felipe/Android/Sdk/ 
      JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 
      Subproject Path: CordovaLib 

      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:2.2.3. 
      Required by: 
      project : 
      > Could not resolve com.android.tools.build:gradle:2.2.3. 
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'. 
      > Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'. 
      > sun.security.validator.ValidatorException: PKIX path building failed: 
      sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested 
      target 

      * 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: 2.176 secs 
      Error: /home/felipe/ionic-testes/sidemenu/platforms/android/gradlew: Command failed with exit code 1 Error 
      output: 
      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:2.2.3. 
      Required by: 
      project : 
      > Could not resolve com.android.tools.build:gradle:2.2.3. 
      > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'. 
      > Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom'. 
      > sun.security.validator.ValidatorException: PKIX path building failed: 
      sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested 
      target 

      * Try: 
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

請。有人能幫助我嗎?感謝您的關注

回答

0

這個請創建項目命令

  1. 離子開始sidemenu sidemenu --blank
  2. 鎘sidemenu
  3. 添加所需的Android平臺,iOS的 4.Cordova構建Android
  4. 科爾多瓦運行Android
+0

我與命令有完全相同的錯誤。 – felipeaf

+0

試試這個:離子cordova運行android --livereload –

0

解決。我剛剛在Android Studio中打開。 我不知道爲什麼,但answar正確的用戶刪除了他的帖子。我已經在Android Studio中安裝了sdk和sdk管理器,並且我安裝了Android Studio提供的其他更新,但只有當我在android studio中打開該項目時,它才需要更新。我想我有一些認證機構在我的開放jdk安裝(我正在使用來自ubuntu存儲庫的openjdk並已安裝ca-certificates-java包)中缺少一些認證機構。但是,現在,它的工作。

相關問題