当我尝试在jenkins中构建Android-studio项目时,我收到此错误: 无法使用TaskExecutionServices.createFileCollectionSnapshotterRegistry()创建FileCollectionSnapshotterRegistry类型的服务。
无法使用TaskExecutionServices.createFileSnapshotter()创建CachingFileHasher类型的服务。
我没有在任何地方找到答案,请帮帮我:)。
Started by user admin
Building in workspace /var/lib/jenkins/workspace/AndroidProject
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/ShiraOzeri/Try_MyTest # timeout=10
Fetching upstream changes from https://github.com/ShiraOzeri/Try_MyTest
> git --version # timeout=10
> git fetch --tags --progress https://github.com/ShiraOzeri/Try_MyTest +refs/heads/*:refs/remotes/origin/*
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 78a492d135b437ee188d71ba44a060540fc56a95 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 78a492d135b437ee188d71ba44a060540fc56a95
> git rev-list 78a492d135b437ee188d71ba44a060540fc56a95 # timeout=10
[Gradle] - Launching build.
[AndroidProject] $ /var/lib/jenkins/workspace/AndroidProject/gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)
Incremental java compilation is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
Could not create service of type FileCollectionSnapshotterRegistry using TaskExecutionServices.createFileCollectionSnapshotterRegistry().
> Could not create service of type CachingFileHasher using TaskExecutionServices.createFileSnapshotter().
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 7.083 secs
FAILURE: Build failed with an exception.
* What went wrong:
java.nio.file.AccessDeniedException: /var/lib/jenkins/workspace/AndroidProject/build/android-profile/profile-2017-06-19-18-24-07-215.rawproto
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
因此。我的解决方案 首先,你需要检查你是否有gradle
要测试Gradle安装,只需从命令行运行Gradle:
gradle
第二,这对我很有帮助,
试试这个:
chown -R jenkins:jenkins <Path to your jenkins>
示例:chown -R jenkins:jenkins / var / lib / jenkins /
谢谢!
答案 0 :(得分:0)
您可以在错误&#34; AccessDeniedException&#34;
中清楚地看到它
- 出了什么问题: java.nio.file.AccessDeniedException:/var/lib/jenkins/workspace/AndroidProject/build/android-profile/profile-2017-06-19-18-24-07-215.rawproto
您可能有用户/组权限问题。尝试查看Jenkins用户是否有权在该文件夹中进行更改(因为Jenkins有不同的用户)。
答案 1 :(得分:0)
我遇到了同样的问题。似乎有些进程正在为它锁定。
我尝试从工作区中的taskArtifacts
文件夹中删除.gradle
,但这不起作用。
最终,只需重新启动Android Studio即可!
注意:我没有尝试原始问题中提到的chown
命令。