Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android emulator plugin doesn't find the android SDK

I'm trying to configure android emulator plugin for Jenkins and I'm having a hard time trying to figure out why the plugin can't find the Android SDK.

First, after cloning the project Jenkins always output:

[android] No Android SDK found; let's install it automatically...  
[android] Going to install required Android SDK components...  
[android] Installing the 'platform-tool,tool' SDK component(s)...  
$ /var/lib/jenkins/tools/android-sdk/tools/android update sdk -u -a -t platform-tool,tool

After that, it fails because the plugin probably doesn't know how to answer the license agreement.

Do you accept the license 'android-sdk-license-bcbbd656' [y/n]: 
Unknown response ''.
Do you accept the license 'android-sdk-license-bcbbd656' [y/n]: 
Unknown response ''.
Max number of retries exceeded. Rejecting 'android-sdk-license-bcbbd656'

So I just replicate the command my self and installed all the stuff. The output remains the same, No Android SDK found. I tried to chown and chmod 755 the folder to be sure that Jenkins can access it and again it failed.

I checked in the Jenkins configuration that I can explicit tell Jenkins where the android SDK is but know it fails with another error: I filled the field Android SDK root with /var/lib/jenkins/tools/android-sdk/ but it shows Required tools not found (adb etc.).

This is my ls -la at /var/lib/jenkins/tools/android-sdk

drwxr-xr-x  9 jenkins jenkins 4096 May 16 11:12 .
drwxr-xr-x  5 jenkins jenkins 4096 May 15 20:20 ..
-rwxr-xr-x  1 jenkins jenkins    6 May 16 12:36 .jenkins-install-info
-rwxr-xr-x  1 jenkins jenkins    0 Dec 20 20:00 .timestamp
-rwxr-xr-x  1 jenkins jenkins 1158 Dec  6 16:50 SDK Readme.txt
drwxr-xr-x  2 jenkins jenkins 4096 May 15 19:45 add-ons
drwxr-xr-x  3 jenkins jenkins 4096 May 16 09:02 build-tools
drwxr-xr-x 19 jenkins jenkins 4096 May 16 09:49 docs
drwxr-xr-x  3 jenkins jenkins 4096 May 16 11:12 platform-tools
drwxr-xr-x  8 jenkins jenkins 4096 May 16 10:43 platforms
drwxr-xr-x  2 jenkins jenkins 4096 May 16 11:12 temp
drwxr-xr-x  9 jenkins jenkins 4096 May 16 11:11 tools

and this is the ls -la at /var/lib/jenkins/tools/android-sdk/platform-tools

drwxr-xr-x 3 jenkins jenkins    4096 May 16 11:12 .
drwxr-xr-x 9 jenkins jenkins    4096 May 16 11:12 ..
-rwxr-xr-x 1 jenkins jenkins  467531 May 16 11:12 NOTICE.txt
-rwxr-xr-x 1 jenkins jenkins 1226659 May 16 11:12 adb
drwxr-xr-x 2 jenkins jenkins    4096 May 16 11:12 api
-rwxr-xr-x 1 jenkins jenkins  176550 May 16 11:12 fastboot
-rwxr-xr-x 1 jenkins jenkins   16644 May 16 11:12 source.properties

which clearly shows that adb is there and running as the command above shows:

sudo -u jenkins ./adb version
Android Debug Bridge version 1.0.31

Any help with this problem will be really appreciated.

like image 226
Raphael Oliveira Avatar asked Mar 24 '23 22:03

Raphael Oliveira


1 Answers

It seems that there is really a bug when trying to accept the license agreement as reported in this issue and the plugin is also looking at the wrong place to find adb since SDK 22 did move it from the original place (issue).

like image 83
Raphael Oliveira Avatar answered Apr 24 '23 11:04

Raphael Oliveira