我在google教程https://developer.android.com/training/basics/firstapp/running-app.html
中使用gradlew构建调试应用程序我创建了项目使用
android create project --target 2 -g -v 2.9--name myAppName --path ./MyAppDirectory --activity MyActivity --package com.mypackage
这是我的build.gradle文件
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
apply plugin: 'android'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion '23.0.2'
buildTypes {
release {
//runProguard false
//minifyEnabled true
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
}
我构建调试应用程序使用命令
$ ./gradlew assembleDebug
并且建筑物冻结率为40%
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources
java.io.IOException: Cannot run program "/home/kanoonsantikul/android-sdk-linux/build-tools/23.0.2/aapt": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at com.android.builder.png.AaptProcess$Builder.start(AaptProcess.java:163)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:106)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:203)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:187)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 4 more
java.io.IOException: Cannot run program "/home/kanoonsantikul/android-sdk-linux/build-tools/23.0.2/aapt": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at com.android.builder.png.AaptProcess$Builder.start(AaptProcess.java:163)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:106)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:203)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:187)
Thread(png-cruncher_5) has a null payload
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 4 more
Thread(png-cruncher_3) has a null payload
java.io.IOException: Cannot run program "/home/kanoonsantikul/android-sdk-linux/build-tools/23.0.2/aapt": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at com.android.builder.png.AaptProcess$Builder.start(AaptProcess.java:163)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:106)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:203)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:187)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 4 more
Thread(png-cruncher_2) has a null payload
java.io.IOException: Cannot run program "/home/kanoonsantikul/android-sdk-linux/build-tools/23.0.2/aapt": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at com.android.builder.png.AaptProcess$Builder.start(AaptProcess.java:163)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:106)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:203)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:187)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 4 more
Thread(png-cruncher_1) has a null payload
java.io.IOException: Cannot run program "/home/kanoonsantikul/android-sdk-linux/build-tools/23.0.2/aapt": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at com.android.builder.png.AaptProcess$Builder.start(AaptProcess.java:163)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:106)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:203)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:187)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 4 more
> Building 40% > :mergeDebugResources
`
答案 0 :(得分:9)
很可能你有一个64位系统,但仍然缺少一些32位用于Android开发。
如果您使用的是64位Ubuntu系统,请参阅32-bit-libs for Ubuntu 64-bit Android Development以获取更多详细信息。
如果您使用的是64位Fedora系统,请参阅installing-android-sdk-on-64-bit-fedora/以获取更多详细信息。
答案 1 :(得分:0)
通过安装库修复
sudo apt-get install lib32z1
sudo apt-get install zlib1g:i386