I'm using gradle 2.9, Android SDK 24.4.1, and Build tools 23.0.2 on 64-bit windows 7. I updated gradle build script to support multidex (per How to enable multidexing with the new Android Multidex support library) but I encounter this build error
Exception in thread "stderr" java.lang.RuntimeException: Invalid aapt version, version 21 or above is required
at com.android.builder.png.AaptProcess$ProcessOutputFacade.err(AaptProcess.java:217)
at com.android.utils.GrabProcessOutput$1.run(GrabProcessOutput.java:102)
(repeats itself more than 10 times), and then
Exception in thread "png-cruncher_1" 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:206)
at java.lang.Thread.run(Thread.java:745)
(repeats itself more than 10 times with different values of png-cruncher_X (x = 1 to 20))
and the build hangs. I found similar reports (regarding the timeout part) where it was fixed by getting latest versions of certain libraries (Android Studio fails to build new project, timed out while wating for slave aapt process ) but I'm on windows and I think I've latest Android SDK & build-tools. Anyone knows how to fix this? Thanks.