我正在尝试为 Jenkins 配置android 模拟器插件,但我很难弄清楚为什么插件找不到 Android SDK。
首先,克隆项目后Jenkins总是输出:
[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
之后,它会失败,因为插件可能不知道如何回答许可协议。
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'
所以我只是复制了我自己的命令并安装了所有的东西。输出保持不变,没有找到 Android SDK。我尝试 chown 和 chmod 755 文件夹以确保 Jenkins 可以访问它,但它再次失败。
我检查了 Jenkins 配置,我可以明确告诉 Jenkins android SDK 在哪里,但知道它因另一个错误而失败:我用/var/lib/jenkins/tools/android-sdk/填充字段Android SDK root但它显示为必需未找到工具(adb 等)。
这是我的ls -la在/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
这是/ var/lib/jenkins/tools/android-sdk/platform-tools的ls -la
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
这清楚地表明 adb 在那里并且正在运行,如上面的命令所示:
sudo -u jenkins ./adb version
Android Debug Bridge version 1.0.31
对此问题的任何帮助将不胜感激。