Ionic Android版本停止运行

时间:2015-07-14 18:45:12

标签: java android cordova ionic-framework android-gradle

在更新Ionic和Cordova CLI后,我的Ionic / Cordova应用程序突然停止在Android上构建。我花了最近两天的时间在谷歌搜索解决方案,但我找不到任何有帮助的东西。我假设它现在与Cordova有关,现在使用Gradle构建而不是Apache Ant。我的Android SDK和构建工具都是第22版,Gradle 2.2,Ant 1.9.4,JDK 8。

其他详情:
Cordova CLI:5.1.1
离子CLI版本:1.6.1
Ionic App Lib版本:0.3.3
操作系统:Mac OS X Yosemite 节点版本:v0.12.7

当我运行ionic build android时,我收到此错误:

FAILURE: Build failed with an exception.

* Where:
Script '/platforms/android/CordovaLib/cordova.gradle' line: 128

* What went wrong:
A problem occurred evaluating root project 'android'.
> No match found

* 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.426 secs

/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /platforms/android/gradlew with args: cdvBuildDebug,-b,/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /platforms/android/cordova/build: Command failed with exit code 1
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)

1 个答案:

答案 0 :(得分:29)

您可能需要在config.xml文件中设置android-versionCode。通过将代码从“0.0.1”更改为“1”,我遇到了类似的问题。显然Android需要一个整数值。

在我的config.xml中,我不得不改变这个:

<widget id="com.acme.appname" version="0.0.1" android-versionCode="0.0.1" ios-CFBundleVersion="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

到此:

<widget id="com.acme.appname" version="0.0.1" android-versionCode="1" ios-CFBundleVersion="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">

android-versionCode

我希望这会有所帮助。