【问题标题】:FAILURE: Build failed with an exception in ionicFAILURE:构建失败,离子中出现异常
【发布时间】:2015-12-19 00:32:12
【问题描述】:

我是 ionic 新手,只是尝试使用下面提到的命令对我的演示项目进行未签名构建:-

cordova build --release android

但是这个东西在构建 apk 时返回错误。谁能告诉我应该怎么做才能通过命令行获取这个未签名的 Apk。

这是我的错误信息:-

* Where:
Build file '/home/ravi/Music/FenoLabs/platforms/android/CordovaLib/build.gradle' line: 49

* What went wrong:
A problem occurred evaluating project ':..:..:..:..:..:Music:FenoLabs:platforms:android:CordovaLib'.
> Project with path ':CordovaLib' could not be found in project ':..:..:..:..:..:Music:FenoLabs:platforms:android:CordovaLib'.

* 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: 3.385 secs

/home/ravi/Documents/IonicTest/myDemoApp/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /home/ravi/Documents/IonicTest/myDemoApp/platforms/android/gradlew with args: cdvBuildRelease,-b,/home/ravi/Documents/IonicTest/myDemoApp/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /home/ravi/Documents/IonicTest/myDemoApp/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /home/ravi/Documents/IonicTest/myDemoApp/platforms/android/cordova/build: Command failed with exit code 8
    at ChildProcess.whenDone (/usr/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:755:16)
    at Process.ChildProcess._handle.onexit (child_process.js:822:5)

这是我在 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
    if (gradle.gradleVersion >= "2.2") {
        dependencies {
            classpath 'com.android.tools.build:gradle:1.0.0+'
        }
    } else if (gradle.gradleVersion >= "2.1") {
        dependencies {
            classpath 'com.android.tools.build:gradle:0.14.0+'
        }
    } else {
        dependencies {
            classpath 'com.android.tools.build:gradle:0.12.0+'
        }
    }
}

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

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

谢谢

【问题讨论】:

    标签: android cordova ionic


    【解决方案1】:

    安装这个库。我修复了使用这些文件安装的问题。

    sudo apt-get install lib32stdc++6

    sudo apt-get install lib32z1

    【讨论】:

      【解决方案2】:

      尝试通过以下命令更新您的 SDK:

      android update sdk --no-ui --filter build-tools-24.0.2,android-24,extra-android-m2repository
      

      【讨论】:

        【解决方案3】:

        几个月前我也遇到了这个问题,并且能够通过访问下面给出的链接来解决这个问题:-

        ionic build android error when download gradle

        所以简而言之,您的问题可以通过使用以下命令来解决:-

        cordova build android -- --ant

        干杯

        【讨论】:

        • 使用此命令后出现此错误Error: Project contains at least one plugin that requires a system library. This is not supported with ANT. Please build using gradle. cordova build android -- --ant
        • <preference name="android-build-tool" value="gradle" /> 将此行添加到我的 config.xml 后,我得到了同样的错误
        猜你喜欢
        • 2016-11-27
        • 1970-01-01
        • 1970-01-01
        • 2018-07-28
        • 2018-10-22
        • 1970-01-01
        • 2023-03-12
        • 2018-10-29
        相关资源
        最近更新 更多