Cannot run program “/opt/android-sdk/platform-tools/aapt”

It seems that Google did a big reorg of the Android SDK file tree, and some tools still expect things in the old locations, like our Jenkins build server:

FATAL: Cannot run program "/opt/android-sdk/platform-tools/aapt" (in directory ": error=2, No such file or directory Cannot run program "/opt/android-sdk/platform-tools/aapt" (in directory ": error=2, No such file or directory
	at java.lang.ProcessBuilder.start(
	at hudson.Proc$LocalProc.(
	at hudson.Proc$LocalProc.(
	at hudson.Launcher$LocalLauncher.launch(
	at hudson.Launcher$ProcStarter.start(
	at hudson.Launcher$ProcStarter.join(
	at hudson.plugins.android_emulator.util.Utils.runAndroidTool(
	at hudson.plugins.android_emulator.util.Utils.runAndroidTool(
	at hudson.plugins.android_emulator.builder.AbstractBuilder.getPackageIdForApk(
	at hudson.plugins.android_emulator.builder.AbstractBuilder.uninstallApk(
	at hudson.plugins.android_emulator.InstallBuilder.perform(
	at hudson.tasks.BuildStepMonitor$1.perform(
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(
	at hudson.model.Build$
	at hudson.model.Build$BuildExecution.doRun(
	at hudson.model.AbstractBuild$
	at hudson.model.Run.execute(
	at hudson.model.ResourceController.execute(
Caused by: error=2, No such file or directory
	at java.lang.UNIXProcess.(
	at java.lang.ProcessImpl.start(
	at java.lang.ProcessBuilder.start(
	... 19 more

Luckily there are symlinks! This fixed it for me:

cd /opt/android-sdk
ln -s 18.0.1 build-tools/current
ln -s ../build-tools/current/aapt platform-tools/aapt
ln -s ../build-tools/current/lib platform-tools/lib

Then whenever the build-tools get updated, just the symlink in /opt/android-sdk/build-tools/current needs to be updated. This is a little improvement on the solution found here.


You must be logged in to post a comment.

%d bloggers like this: