Search code examples
androidjenkinsjenkins-pluginsandroid-emulator-plugin

Jenkins tries to launch tools/emulator instead of emulator/emulator (Android Emulator Plugin)


I'm trying to set up Jenkins UI tests, and it fails on running emulator command, which was moved from {$ANDROID_SDK}/tools/emulator to {$ANDROID_SDK}/emulator/emulator in one of android sdk tools update.

I'm not sure why: the Android Emulator Plugin is in version 3.0 which should already use emulator/emulator path. Jenkins ver. 2.204.1

[android] Erasing existing emulator data...
$ /var/lib/android/tools/emulator -ports 5724,5725 -report-console tcp:5825,max=60 -avd pixel-2-api28 -wipe-data -no-window
FATAL: Cannot run program "/var/lib/android/tools/emulator": error=2, No such file or directory
java.io.IOException: error=2, No such file or directory

Am I missing something?


Solution

  • I'm answering my own question - It's an issue with Android Emulator Plugin 3.0 not working with new "Command line tools only" sdk package. I used it on my build server, which obviously sound like something to choose for a build server in comparison to full Android Studio package.

    The issue is about how the plugin checks tools versioning, it looks for a property named Pkg.Revision in file {$ANDROID_SDK}/tools/source.properties.

    For "command line tools" it looks like this:

    Pkg.Revision=1.0
    Pkg.Path=cmdline-tools;1.0
    Pkg.Desc=Android SDK Command-line Tools
    

    For earlier sdks it looks like e.g this:

    Pkg.UserSrc=false
    Pkg.Revision=26.1.1
    Platform.MinPlatformToolsRev=20
    Pkg.Dependencies=emulator
    Pkg.Path=tools
    Pkg.Desc=Android SDK Tools
    

    The plugin checks if version is higher than 25.3 (AndroidSdk.java:161), which for command line tools is obviously not.

    I'll post a bug report, and I'll update here if I'll find a workaround.