无法在新安装的 Android 工作室中构建或清理裸单 activity 项目

Unable to build, nor clean a naked single activity project in a newly installed Android studio

我最近在 Ubuntu 14.04 LTS 上安装了 Android Studio 的最新稳定版本。 SDK 已正确配置。

我从空白 Activity 模板创建了一个 'Activity' 项目,并且没有对其进行任何更改。

尝试构建或清理时,我偶尔会得到以下信息:

Failed to complete Gradle execution.

Cause:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

seems to be caused 由 VM 的堆大小决定。但是添加 XX:MaxPermSize=1024m 只会减少它出现的次数,这意味着,有时我没有得到这个错误,没有改变任何东西。 所以要么它不是真正的解决方案,要么 1024m 不够(这似乎不对..)

但是,当我没有收到此错误时,构建仍然失败:

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
/home/a/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
/home/a/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
/home/a/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
/home/a/Android/Sdk/build-tools/19.1.0/aapt: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
:app:mergeDebugResources FAILED
/home/a/AndroidStudioProjects/useless/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/a/Android/Sdk/build-tools/19.1.0/aapt'' finished with non-zero exit value 127
Error:Execution failed for task ':app:mergeDebugResources'.
> /home/a/AndroidStudioProjects/useless/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/a/Android/Sdk/build-tools/19.1.0/aapt'' finished with non-zero exit value 127
Information:BUILD FAILED
Information:Total time: 13.341 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console

并没有真正提供信息。

OK,奇怪的是可能this 解决了问题(第二个)。 这很奇怪,因为无法从 gradle 开始理解它。

您必须安装这些软件包才能解决此错误,因为 Android SDK 仍无法在 UBUNTU 64 位上运行。

sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1

在 ubuntu 14.10[64 位] 和 15.04[64 位] 中你可以解决这个问题以及 this genymotion 的问题

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

祝你好运!!