Android SDK installation failed (Jenkins' Android Emulator plugin) Caused by: java.io.IOException: Failed to donwload SDK archive

Viewed 605

I've been trying to integrate Android Emulator in my Jenkins workflow on my Windows PC using this plugin. I've been facing this error.

Started by user admin
Running as SYSTEM
[EnvInject] - Loading node environment variables.
Building in workspace C:\Users\user\.jenkins\workspace\Testing if android emulator works
[android] Outdated SDK Tools found. Upgrading from '26.1.1' to 'build 6609375'
[android] Android SDK installation failed
[android] hudson.plugins.android_emulator.SdkInstallationException: Failed to download Android SDK
    at hudson.plugins.android_emulator.SdkInstaller.doInstall(SdkInstaller.java:91)
    at hudson.plugins.android_emulator.SdkInstaller.install(SdkInstaller.java:72)
    at hudson.plugins.android_emulator.AndroidEmulator.setUp(AndroidEmulator.java:278)
    at hudson.model.Build$BuildExecution.doRun(Build.java:157)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514)
    at hudson.model.Run.execute(Run.java:1907)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Caused by: java.io.IOException: Failed to donwload SDK archive
    at hudson.plugins.android_emulator.SdkInstaller.installBasicSdk(SdkInstaller.java:189)
    at hudson.plugins.android_emulator.SdkInstaller.doInstall(SdkInstaller.java:89)
    ... 8 more

Finished: NOT_BUILT

I have taken the following steps after seeing people's discussions on SO and other websites (but haven't been able to resolve the issue):

  • Updated to latest android skd, and sdk command line tools. Also, updated possibly everything else that I could from Android Studio.
  • Added windows/system32 in path in env variables
  • Ran cmd as admin to run jenkins (realised later that it's a bad idea as scripts can do anything)
  • Went to http://localhost:8080/configure > set Android SDK root variable.
  • Went to http://localhost:8080/configure > tick Environment variables > set ANDROID_HOME & JAVA_HOME variables.
  • Went to http://localhost:8080/configureTools/ > set jdk installation.

Note: I've verified that all environment variables are correct.

Here's some of my thought process:

  • The error message says that it's trying to update tools from v 26.1.1 to a newer version. But I don't even have sdk tools of this version in my Android SDK!

  • This may hint to a dual installation of Android sdk but there only one. And after that, I don't know what's wrong...

I'm stuck on this for several days now & any help or suggestion will be greatly appreciated :)

1 Answers

In the ENV, you specified paths to internal Android SDK tools? For example, you add to PATH /emulator and /platform-tools folders? This folders contains in the Android SDK root.

Related