简体   繁体   中英

jenkins build fail with adb not found

I was trying to build my android studio project set up with jenkins, I get into an error adb not found ,, i am using the gradle emulator plugin.

 java.io.IOException: Cannot run program "/var/lib/jenkins/tools/android-sdk/platform-tools/adb": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:803)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at hudson.plugins.android_emulator.AndroidEmulator.doSetUp(AndroidEmulator.java:304)
at hudson.plugins.android_emulator.AndroidEmulator.setUp(AndroidEmulator.java:263)
at hudson.model.Build$BuildExecution.doRun(Build.java:154)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:536)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
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:186)
at java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 12 more

Finished: FAILURE

$ /var/lib/jenkins/tools/android-sdk/tools/android list target
[android] Using Android SDK: /var/lib/jenkins/tools/android-sdk
$ /var/lib/jenkins/tools/android-sdk/platform-tools/adb start-server

it seems like jenkins is using the android sdk folder, so I don't think its a path related issue

in local mechine I've had this same error before ( the solution was to install a collection of libraries)

sudo apt-get install ia32-libs

but i'm not sure how to do it in jenkins..

any thoughts? thanks

you should configure ANDROID_HOME in jenkins

  1. open jenkins
  2. login with admin
  3. click manage jenkins on left menu
  4. click configure system
  5. set ANDROID_HOME

在此处输入图片说明

You need to specify your adb path in the Jenkins in the execute shell in the Build step.

export Path = "which ever your path is"

you can get your adb path with which adb

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM