I'm trying to use the Android Emulator Plugin to automate the installation of the Android SDK, for the purpose of building Android apps. The plugin supports this capability and it would allow for nodes to not have to pre-install the Android SDK.
The Slave Setup
I am using a Debian Stretch slave connected via SSH. The connection of this slave was configured without problems. When it was first connected, I gave it a home directory of
/home/jenkins/slave, and Jenkins installed a
slave.jar there as well as the JDK needed to run the jar file at
/home/jenkins/slave/jdk. It runs fine.
The Job Setup
I created a new job and in the Build Environment section, I enabled Run An Android Emulator During Build. I gave it an Android OS version of 4.1, screen density 480, etc. to satisfy the emulator requirements. I used a label to ensure it builds on the slave.
During the build, it installs another JDK, this time into
/home/jenkins/slave/tools/hudson.model.JDK/JDK. Then, it downloads the Android SDK and installs it into
/home/jenkins/slave/tools/android-sdk. This also succeeded.
But then, it tries to run the
android tool and this tool doesn't find the JDK. Doing some investigating, it seems that Jenkins and the plugin doesn't modify the path to include the JDK installation path, nor does the
android script itself look at
JAVA_HOME or other variable to try to find the JDK.
The build log is here.
Is there anything I can do to make this setup automatically install the JDK and the Android SDK and have them work together?