Linux 错误:无法运行 aapt

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18041769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 00:27:35  来源:igfitidea点击:

Error: Cannot run aapt

androidlinuxadtaapt

提问by user1104939

When I compile an android application ( I tried with the sample ones from the sdk). I get this error:

当我编译一个 android 应用程序时(我尝试了 sdk 中的示例应用程序)。我收到此错误:

>Error executing aapt: Cannot run program "/home/roel/projects/sdk/build-tools/18.0.1/aapt": >error=2, No such file or directory: error=2, No such file or directory    KeyChainDemo        >line 1 Android ADT Problem

But aapt is at that location?

但是 aapt 在那个位置?

>[roel@archUSB 18.0.1]$ ls /home/roel/projects/sdk/build-tools/18.0.1/

>NOTICE.txt  aidl     dx   libLLVM.so  libbcinfo.so  llvm-rs-cc    source.properties
>**aapt**        dexdump  lib  libbcc.so   libclang.so   renderscript

Note: I also get the error "R cannot be resolved", but I'm pretty sure that when I solve problem 1, I also solve this problem

注意:我也收到错误“R无法解决”,但我很确定当我解决问题1时,我也解决了这个问题

采纳答案by Benjamin

Ubuntu 14.04.1 LTS solution:

Ubuntu 14.04.1 LTS 解决方案:

sudo apt-get update 
sudo apt-get install gcc-multilib lib32z1 lib32stdc++6

Reason: aapt needs 32-bit libraries installed

原因:aapt 需要安装 32 位库

回答by user1104939

The problem was my 64bit OS , I missed some 32 bit libs ;)

问题是我的 64 位操作系统,我错过了一些 32 位库;)

回答by pal

I had this same problem today. If anyone from the future is having this problem, try the solution here

我今天遇到了同样的问题。如果将来有人遇到此问题,请在此处尝试解决方案

Programs running aapt in android sdk from shell and from sbt

从 shell 和 sbt 在 android sdk 中运行 aapt 的程序

回答by Lesik2008

I had the same problem today, thishelped me.

我今天遇到了同样的问题,对我有帮助。

Arch Linux 64bit.

Arch Linux 64 位。

回答by Sileria

Debian 7 Wheezy solution:

Debian 7 Wheezy 解决方案:

sudo dpkg --add-architecture i386
sudo apt-get update 
sudo apt-get install ia32-libs

回答by Afaque H

Ubuntu 13.10 solution:

Ubuntu 13.10 解决方案:

Append

附加

deb http://archive.ubuntu.com/ubuntu/ raring main restricted universe multiverse 

to /etc/apt/sources.list.

/etc/apt/sources.list。

sudo apt-get update
sudo apt-get install ia32-libs

回答by eviltnan

SDK tools 24 has a bug, build will fail with the same error. Should be fixed in the new version, for now the workaround in tools/ant/build.xml place

SDK 工具 24 有一个错误,构建将失败并显示相同的错误。应该在新版本中修复,目前在 tools/ant/build.xml 中的解决方法

<property name="aapt" location="${sdk.dir}/build-tools/22.0.1/aapt" />
<property name="aidl" location="${sdk.dir}/build-tools/22.0.1/aidl" />
<property name="dx" location="${sdk.dir}/build-tools/22.0.1/dx" />
<property name="zipalign" location="${sdk.dir}/build-tools/22.0.1/zipalign" />

at the end of the xml in the root tag. Replace 22.0.1 with your build tools version

在根标记中 xml 的末尾。将 22.0.1 替换为您的构建工具版本

回答by Scott Stensland

aapt is a 32 bit application and will fail on a 64 bit box until 32 bits are enabled and libs added

aapt 是一个 32 位应用程序,将在 64 位机器上失败,直到启用 32 位并添加库

This is current solution as of Ubuntu 16.04 / 17.10

这是 Ubuntu 16.04 / 17.10 的当前解决方案

dpkg --print-foreign-architectures  #  if below was never run this returns nothing ... afterwards it will return : i386
sudo dpkg --add-architecture i386
sudo apt-get -qqy update
sudo apt-get -qqy install libncurses5:i386 libstdc++6:i386 zlib1g:i386