我正在尝试通过jenkins为我的android应用程序构建apk。我按照this教程进行操作。我遇到的问题是,我的Android SDK安装在单独的硬盘中(而不是安装jenkins的硬盘)。
因此我在环境变量中为sdk设置的路径没有被jenkins标识,并且构建失败。但是我通常可以使用具有相同sdk路径的Android Studio来构建apk。
P.S Android Studio与jenkins的安装位置相同。我提到了this解决方案,但还是没有运气。另外,由于磁盘空间问题,我无法将sdk移动到安装了jenkins的磁盘上。请问有人可以帮我吗?
请参阅Jenkins中的控制台日志
16:52:08 Started by user Darrel Rayen
16:52:08 Building in workspace /var/lib/jenkins/workspace/android-
recruiter-app
16:52:08 > git rev-parse --is-inside-work-tree # timeout=10
16:52:08 Fetching changes from the remote Git repository
16:52:08 > git config remote.origin.url
https://DarrelR@bitbucket.org/harver/android-recruiter-app.git #
timeout=10
16:52:08 Fetching upstream changes from
https://DarrelR@bitbucket.org/harver/android-recruiter-app.git
16:52:08 > git --version # timeout=10
16:52:08 using GIT_ASKPASS to set credentials
16:52:08 > git fetch --tags --progress
https://DarrelR@bitbucket.org/harver/android-recruiter-app.git
+refs/heads/*:refs/remotes/origin/*
16:52:12 > git rev-parse refs/remotes/origin/master^{commit} #
timeout=10
16:52:12 > git rev-parse refs/remotes/origin/origin/master^{commit} #
timeout=10
16:52:12 Checking out Revision
1609ea0ced1febf6a6cbb8bbd9488637c2c70e1a (refs/remotes/origin/master)
16:52:12 > git config core.sparsecheckout # timeout=10
16:52:12 > git checkout -f 1609ea0ced1febf6a6cbb8bbd9488637c2c70e1a
16:52:12 Commit message: "Merged in AMOB-264-end-to-end-testing-for-
the-cand (pull request #57)"
16:52:12 > git rev-list --no-walk
1609ea0ced1febf6a6cbb8bbd9488637c2c70e1a # timeout=10
16:52:12 [Gradle] - Launching build.
16:52:12 [android-recruiter-app] $ /var/lib/jenkins/workspace/android-
recruiter-app/gradlew clean assembleDebug test connectedAndroidTest
16:52:12 Starting a Gradle Daemon (subsequent builds will be faster)
16:52:16
16:52:16 FAILURE: Build failed with an exception.
16:52:16
16:52:16 * What went wrong:
16:52:16 A problem occurred configuring project ':app'.
16:52:16 > The SDK directory '/media/darrel/NewDisk' does not exist.
16:52:16
16:52:16 * Try:
16:52:16 Run with --stacktrace option to get the stack trace. Run with
--info or --debug option to get more log output. Run with --scan to
get full insights.
16:52:16
16:52:16 * Get more help at https://help.gradle.org
16:52:16
16:52:16 BUILD FAILED in 4s
16:52:16 Build step 'Invoke Gradle script' changed build result to
FAILURE
16:52:16 Build step 'Invoke Gradle script' marked build as failure
16:52:17 Finished: FAILURE
答案 0 :(得分:1)
我从this找到了解决问题的方法。我必须使用以下步骤更新用户的访问权限,以访问已安装的驱动器
1。卸载已安装的设备( / dev / sdb 是检测到的硬盘名称)
umount /dev/sdb
chmod -R 0777 /mnt/
2。最终安装硬盘
mount /dev/sdb /mnt
3。然后我将sdk路径指定为/ mnt / Android / Sdk