29

I've installed Android Studio 1.2, and created a new project. When I attempt to build, it hangs. This is in the Gradle Console, along with about 20 other copies, with different numbers after png-cruncher_:

Exception in thread "png-cruncher_2" java.lang.RuntimeException: Timed out while waiting for slave aapt process, try setting environment variable SLAVE_AAPT_TIMEOUT to a value bigger than 5 seconds
at com.android.builder.png.AaptProcess.waitForReady(AaptProcess.java:104)
at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:107)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:204)
at java.lang.Thread.run(Thread.java:745)
Carson English
  • 291
  • 1
  • 3
  • 3
  • "along with about 20 other copies, with different numbers after png-cruncher_:", what? Is this a new project? – Jared Burrows May 07 '15 at 21:57
  • Yes, this happened for me with a new project. There were more errors further up in the console, and all was fixed after I installed some 32-bit support libs. – Steven Bell May 25 '15 at 06:32
  • 1
    I have this same problem on Mac OS/X 10.7.5 Lion. Installing the Android Support Library, described below, does not help. I am running Android Studio 1.3.2. The project I am trying to build is one of the SDK Samples: ActionBarCompat-Basic. – jsp Sep 02 '15 at 02:08
  • See this http://stackoverflow.com/a/36826562/1770868 – Ahmad Aghazadeh Dec 04 '16 at 17:57
  • See discussion at [Android Issue 188627](https://code.google.com/p/android/issues/detail?id=188627). – Joe Bowbeer Dec 18 '16 at 02:15

11 Answers11

58

I had the same problem with Debian Jessie for AMD64. I did this, and it works:

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386
hichris123
  • 10,145
  • 15
  • 56
  • 70
Raul Caceres
  • 581
  • 3
  • 3
27

I had the same issue whilst running Android Studio 1.5.1 for Windows 8.1 (64 bit), and what I did to solve the problem was by adding the following two system environment variables:

SLAVE_AAPT_TIMEOUT = 30
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_65

(Please note: The path for the JAVA_HOME system environment variable is dependant on where your JDK is located and that the version of your JDK may differ from the example above).

Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
Luke Beveridge
  • 505
  • 1
  • 6
  • 19
  • Setting `SLAVE_AAPT_TIMEOUT` done it for me cheers, mr beveridge – Armand May 30 '17 at 10:13
  • @Luke Beveridge: where to set Enviornment variable ? – Swift Sep 06 '17 at 12:29
  • @AndroidGeeks Assuming that you are using Windows8/Windows10, you can navigate to this by opening the Control panel then clicking: System --> Advanced System settings --> Environment Variables. Once here, you will be able to create new environment variables or edit existing ones. – Luke Beveridge Sep 06 '17 at 13:21
3

I had this problem on Windows 8.1 64 bits and what ended up solving everything was running gradle in the command line in debug mode, on the project folder:

gradlew -d assembleDebug

Running without the -d flag had the same problem.

After running the first time, everything was ok, I could even clean and rebuild my project.

ianribas
  • 1,296
  • 10
  • 12
3

I had this problem and what was missing were a library to be installed on the SDK. Just installing the correct library immediately solved the problem. In my case was the Android Support Library, as I was creating a navigation drawer. The errors shown in the gradle console didn't give me a clue for the solution, and didn't helped me at all. Click on SDK manager, and click on the tab SDK Tools, check "Android Support Library" and click apply.

Flávio Filho
  • 475
  • 4
  • 14
3

This is a known bug reported here --> https://code.google.com/p/android/issues/detail?id=188627

The workaround on Mac is to reboot your computer.

Juliano Moraes
  • 169
  • 2
  • 3
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/15291327) – Shawn Feb 21 '17 at 23:15
  • The answer is, restart your machine to fix this issue. – Juliano Moraes Feb 22 '17 at 18:54
2

If you are running on a Linux x64 machine you probably miss some required libraries. The offical sdk guide states:

Required libraries for 64-bit machines:

If you are running a 64-bit version of Ubuntu, you need to install some 32-bit libraries with the following command:

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 lib32bz2-1.0

If you are running 64-bit Fedora, the command is:

sudo yum install zlib.i686 ncurses-libs.i686 bzip2-libs.i686

of course don't forget to

sudo apt-get update

first.

Patrick
  • 33,984
  • 10
  • 106
  • 126
  • For fedora 24 following command does the work for me: sudo dnf install compat-libstdc++-296.i686 compat-libstdc++-33.i686 compat-libstdc++-33.x86_64 ncurses-libs.i686 – Sukhbir Jan 25 '17 at 13:51
1

By pausing the antivirus I don't have anymore that problem, or better by making a rule at the antivirus in order to accept a given '.class' filename recognized as trojan, then banned at compile-time.

Kreshnik
  • 2,661
  • 5
  • 31
  • 39
1

Check your firewall if it is coming in your way. Disabling my firewall works for me but i don't know if it's the right fix.

KingKongCoder
  • 600
  • 4
  • 15
1

I had the same problem with CentOS 6.5. Before this error, I found the cause of the error, as follows.

AAPT err(Facade for 1129807373): xxx/aapt: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by xxx/lib64/libc++.so)

libc.so.6: version `GLIBC_2.14' not found” . The highest version of CentOS 6.5 is 2.12, and we need to upgrade to 2.14.

Display the installed glibc version:

# rpm -qa | grep glibc

To download the corresponding RPM package. -> ftp.redsleeve.org/pub/steam/

Install the RPM package as follows:

# rpm -Uvh glibc-2.15-60.el6.x86_64.rpm glibc-common-2.15-60.el6.x86_64.rpm glibc-devel-2.15-60.el6.x86_64.rpm glibc-headers-2.15-60.el6.x86_64.rpm --nodeps --force
iOnesmile
  • 99
  • 4
0

I uninstalled 1.2 and installed 1.1, but it did't work.

Because I used local SDK installed previously, I uninstalled and reinstalled 1.1 and installed SDK to new path.

After I used SDK in new path, I don't have those errors any more.

And I upgraded Android Studio to 1.2, and also I don't have errors.

0

Downgrading Build Tools rescued me.

Mateusz Kaflowski
  • 2,221
  • 1
  • 29
  • 35