使用ionic构建Android应用程序:
[root@localhost ionic-app-base-master]# ionic build android
控制台日志显示这些消息:
Running command: /root/ionic-tutorial/conference/ionic-app-base-master/hooks/after_prepare/010_add_platform_class.js /root/ionic-tutorial/conference/ionic-app-base-master
add to body class: platform-android
ANDROID_HOME=/usr/local/lib/android-sdk
JAVA_HOME=/usr/java/jdk1.8.0_45
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:processDebugResources'.
> A problem occurred starting process 'command '/usr/local/lib/android-sdk/build-tools/23.0.2/aapt''
* 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.503 secs
Error: Error code 1 for command: /root/ionic-tutorial/conference/ionic-app-base-master/platforms/android/gradlew with args: cdvBuildDebug,-b,/root/ionic-tutorial/conference/ionic-app-base-master/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
我查了很多门票&我执行了很多更改,例如:
Conflict with android support version on cordova build android
https://forum.ionicframework.com/t/ionic-android-build-problem/29131/5
已知当前config.xml
为:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.ionicframework.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
<name>HelloCordova</name>
<description>
An Ionic Framework and Cordova project.
</description>
<author email="me@abdennoor.com" href="http://abdennoor.com">
Abdennour TOUMI
</author>
<content src="index.html" />
<access origin="*" />
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<!-- Ionic supports Android Jellybean and up -->
<preference name="android-minSdkVersion" value="16" />
<!-- Don't store local data in an iCloud backup. Turn this to "cloud" to enable storage
to be sent to iCloud. Note: enabling this could result in Apple rejecting your app.
-->
<preference name="BackupWebStorage" value="none" />
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true" />
</feature>
</widget>
Android SDK : 23.1.0
Ionic : 1.7.4
Cordova : 6.1.0
gradle : 2.2.1
JVM : 1.8.0_45 (Oracle Corporation 25.45-b02)
Groovy : 2.3.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
OS: Linux 3.10.0-327.10.1.el7.x86_64 amd64
答案 0 :(得分:4)
也许您正试图在64位系统上运行Android SDK(安装在32位文件上)。 我解决了在Ubuntu上运行命令的问题。根据您的系统,尝试以下选项之一:
sudo apt-get install libgl1-mesa-dev
sudo apt-get install ia32-libs
sudo apt-get install libgl1-mesa-dev:i386
答案 1 :(得分:0)
检查您的文件名,我遇到了同样的问题,并通过从文件名中删除特殊字符来解决。