当我运行 离子型机器人命令在根离子项目,我得到这个错误:
失败: 构建失败,有异常。
位置: Script’/home/javad/Desktop/javadApp/Platform/android/CordovaLib/cordova.gradle’ 行: 64
错误: 评估根项目“ android”时出现问题。
找不到已安装的构建工具。请安装 Android 构建工具版本19.1.0或更高版本。
尝试: 使用—— stacktrace 选项运行以获取堆栈跟踪。使用—— info 或—— debug 选项运行以获得更多的日志输出。
javad@javad:~/Desktop/javadApp$ ionic build android
Running command: /home/javad/Desktop/javadApp/hooks/after_prepare/010_add_platform_class.js /home/javad/Desktop/javadApp
add to body class: platform-android
Running command: /home/javad/Desktop/javadApp/platforms/android/cordova/build
ANDROID_HOME=/opt/android-sdk
JAVA_HOME=/usr/lib/jvm/default-java
Running: /home/javad/Desktop/javadApp/platforms/android/gradlew cdvBuildDebug -b /home/javad/Desktop/javadApp/platforms/android/build.gradle -Dorg.gradle.daemon=true
FAILURE: Build failed with an exception.
* Where:
Script '/home/javad/Desktop/javadApp/platforms/android/CordovaLib/cordova.gradle' line: 64
* What went wrong:
A problem occurred evaluating root project 'android'.
> No installed build tools found. Please install the Android build tools version 19.1.0 or higher.
* 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.564 secs
/home/javad/Desktop/javadApp/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /home/javad/Desktop/javadApp/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/javad/Desktop/javadApp/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /home/javad/Desktop/javadApp/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/javad/Desktop/javadApp/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
在 ~/. 配置文件中我有:
Export PATH = $PATH:/opt/android-sdk/tools
Export PATH = $PATH:/opt/android-sdk/Platform-tools
Export PATH = $PATH:/opt/node/bin
Export JAVA _ HOME =/usr/lib/jvm/default-JAVA
Export ANDROID _ HOME =/opt/ANDROID-sdk
$PATH 是:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/android-sdk/tools:/opt/android-sdk/Platform-tools:/opt/node/bin
重要事项:
/home/javad/Desktop/javadApp/Platform/android/CordovaLib/cordova.gradle | 38号线:
String[] getAvailableBuildTools() {
def buildToolsDir = new File(getAndroidSdkDir(), "build-tools")
buildToolsDir.list()
.findAll { it ==~ /[0-9.]+/ }
.sort { a, b -> compareVersions(b, a) }
}
刚刚返回 /opt/android-sdk/build-tools! ! !
在 /opt/android-sdk/build-tools文件夹中我有:
Android-5.1 文件夹提取自: Https://dl.google.com/android/repository/build-tools_r22-linux.zip