我无法在Ubuntu 16.04 LTS中从ionic获得android构建。
通过安装离子
npm install -g cordova ionic
和
ionic start myApp tabs
还下载了Android SDK并在.bashrc
中设置了ANDROID_HOME
通过
export ANDROID_HOME="/home/arun/softzz/android-sdk/tools"
export PATH=${PATH}:/home/arun/softzz/android-sdk/add-ons
export PATH=${PATH}:/home/arun/softzz/android-sdk/platform-tools
export PATH=${PATH}:/home/arun/softzz/android-sdk/build-tools
并下载了sdk 21
平台工具和构建工具
同样在终端,我已经通过导出了路径
export ANDROID_HOME=/home/arun/softzz/android-sdk
PATH=$PATH:$ANDROID_HOME/platform-tools
PATH=$PATH:$ANDROID_HOME/build-tools
PATH=$PATH:$ANDROID_HOME/tools
从命令行在我的项目文件夹上
ionic platform android
ionic build android
这给了我以下错误
Running command: /home/arun/myApp/hooks/after_prepare/010_add_platform_class.js /home/arun/myApp
add to body class: platform-android
Running command: /home/arun/myApp/platforms/android/cordova/build
/home/arun/myApp/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error: Failed to run "ant -version", make sure you have ant installed and added to your PATH.
at /home/arun/myApp/platforms/android/cordova/lib/check_reqs.js:43:27
at ChildProcess.exithandler (child_process.js:220:5)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:821:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
ERROR building one of the platforms: Error: /home/arun/myApp/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /home/arun/myApp/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/share/cordova-cli/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:821:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
我找到了一个解决方案通过安装ant
通过sudo apt-get install ant
唯一的问题是,每次需要进行构建时,我都想导出路径。有什么解决方案吗??