azurejenkins

Use the Android SDK Manager plugin with Jenkins

When building an Android application using Gradle on Jenkins with the Android SDK Manager Gradle plugin, there may be an error running the aapt tool. Typically, this produces an error message like that shown below:

java.io.IOException: Cannot run program ".android-sdk/build-tools/22.0.1/aapt": error=2, No such file or directory
  at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
  at com.android.builder.png.AaptProcess$Builder.start(AaptProcess.java:163)
  at com.android.builder.png.QueuedCruncher$1.creation(QueuedCruncher.java:106)
  at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:203)
  at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: error=2, No such file or directory
  at java.lang.UNIXProcess.forkAndExec(Native Method)
  at java.lang.UNIXProcess.<init>(UNIXProcess.java:248)
  at java.lang.ProcessImpl.start(ProcessImpl.java:134)
  at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
  ... 4 more

To resolve this, execute the following command to install missing libraries needed by the aapt command:

    $ sudo apt-get install lib32stdc++6 lib32z1
Last modification December 21, 2022