我尝试通过jenkins app构建android应用程序,但android sdk有问题。我在linux服务器上安装了android sdk版本,并配置了变量并做了jenkins站点。
构建信息:
Started by user XYZ
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/
The recommended git tool is: NONE
No credentials specified
> git rev-parse --resolve-git-dir /var/lib/jenkins/workspace//.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url gitlabgit # timeout=10
Fetching upstream changes from gitlabgit
> git --version # timeout=10
> git --version # 'git version 2.17.1'
> git fetch --tags --progress -- gitlab.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/develop^{commit} # timeout=10
Checking out Revision 226418a2e4d787c8d75dd497088efa4347cf7bd0 (refs/remotes/origin/develop)
> git config core.sparsecheckout # timeout=10
> git checkout -f 226418a2e4d787c8d75dd497088efa4347cf7bd0 # timeout=10
> git branch -a -v --no-abbrev # timeout=10
> git branch -D develop # timeout=10
> git checkout -b develop 226418a2e4d787c8d75dd497088efa4347cf7bd0 # timeout=10
Commit message: "Merge branch 'jciszewski/FixCardResponse' into 'develop'"
> git rev-list --no-walk 226418a2e4d787c8d75dd497088efa4347cf7bd0 # timeout=10
[] $ /bin/sh -xe /tmp/jenkins686224158862483808.sh
+ chmod +x gradlew
+ ./gradlew clean
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :clean UP-TO-DATE
> Task :app:clean UP-TO-DATE
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 3s
2 actionable tasks: 2 up-to-date
+ ./gradlew assembleDebug
File /var/lib/jenkins/.android/repositories.cfg could not be loaded.
Checking the license for package Android SDK Build-Tools 30.0.3 in /home/face/android-sdk/android-sdk/licenses
License for package Android SDK Build-Tools 30.0.3 accepted.
Preparing "Install Android SDK Build-Tools 30.0.3 (revision: 30.0.3)".
Warning: Failed to read or create install properties file.
Checking the license for package Android SDK Platform 30 in /home/face/android-sdk/android-sdk/licenses
License for package Android SDK Platform 30 accepted.
Preparing "Install Android SDK Platform 30 (revision: 3)".
Warning: Failed to read or create install properties file.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following SDK components:
platforms;android-30 Android SDK Platform 30
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
The SDK directory is not writable (/home/face/android-sdk/android-sdk)
* Try:
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.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
Build step 'Execute shell' marked build as failure
Archiving artifacts
[PostBuildScript] - [INFO] Executing post build scripts.
Finished: FAILURE
我有一个问题,解决它(我试图改变权限到777,但仍然不工作)
改变android SDK的所有权
chown -R <user_name> <directory_name>
通过将sdk目录从/opt/sdk更改为/home/user/sdk解决