2017-08-08 171 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包)中缺少一些认证机构。但是,现在,它的工作。

相关问题