我无法在Ubuntu 16.04 LTS中使用离子的android构建。
通过
安装离子 npm install -g cordova ionic
和
ionic start myApp tabs
还下载了Android SDK并在ANDROID_HOME
.bashrc
通过
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)
答案 0 :(得分:0)
我找到了解决方案
安装ant
按sudo apt-get install ant
唯一的问题是我想在每次需要构建时导出路径 。 任何解决方案??