IT_Programming/Dev Tools

Android Studio fails to build new project, timed out while wating for slave aapt process

JJun ™ 2015. 5. 17. 13:12



 출처

 : http://stackoverflow.com/questions/30111443/android-studio-fails-to-build-new-project-timed-out-while-wating-for-slave-aapt

 : http://stackoverflow.com/a/31095817

 : http://stackoverflow.com/a/35373926





Q) 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)




A-1)  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



A-2)  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.


A-2)  

https://gist.github.com/ksc91u/37513796b2cec37bb3c5

See the comments in this gist to find locations to put this file.

  1. Rename aapt to aapt.20
  2. Copy aapt from tools version 17 to aapt.17
  3. Put this gist as aapt chmod +x




 aapt malformed 9 patch image

 https://gist.github.com/ksc91u/f167a7d56e0c2646c9c8

 #!/bin/bash
 enable pwd
 args=("$@")
 DIR="$(cd "$(dirname "$0")" && pwd)"
 case "${args[@]}" in  
    *".9.png"*)
        $DIR/aapt.17 $@
    ;;  
    *)  
        $DIR/aapt.20 $@
    ;;  
 esac



 aapt ERROR: 9-patch image malformed

 : https://gist.github.com/ksc91u/37513796b2cec37bb3c5


 #!/usr/bin/perl
 # Fix the following error, using gradle or Android Studio to build some projects with malformed 9 patch image
 # 
 # aapt ERROR: 9-patch image malformed
 # Frame pixels must be either solid or transparent (not intermediate alphas).
 # 
 # put the file as sdk/build-tools/20.0.0/aapt and original aapt as aapt.20
 # put the file as sdk/build-tools/17.0.0/aapt and original aapt as aapt.17
 # force use aapt cruncher by adding:  
 #    android.aaptOptions.useAaptPngCruncher = true 
 # in your build.gradle
 use Cwd 'abs_path';
 use Getopt::Long;
 use File::Copy;
 $argv = join(" ", @ARGV);
 @args = @ARGV;
 if($argv=~m/\.9\.png/){
    $aapt = abs_path($0).".17";  #old aapt does not check 9 patch image
    exec($aapt, @args);
 } else {
    $aapt = abs_path($0).".20";
    exec($aapt, @args);
 }




gistfile1.sh


gistfile1.txt



gistfile1.sh
0.0MB
gistfile1.txt
0.0MB