android - 无法在 Jenkins 建立gradle,无法创建类型的服务

标签 android jenkins gradle

当我尝试在jenkins中进行Build Android-studio项目时,出现此错误:
无法使用TaskExecutionServices.createFileCollectionSnapshotterRegistry()创建FileCollectionSnapshotterRegistry类型的服务。

Could not create service of type CachingFileHasher using TaskExecutionServices.createFileSnapshotter().



我没有在任何地方找到答案,请帮助我:)
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 /

谢谢!!

最佳答案

您可以在错误“AccessDeniedException”中清楚地看到它

  • What went wrong: java.nio.file.AccessDeniedException: /var/lib/jenkins/workspace/AndroidProject/build/android-profile/profile-2017-06-19-18-24-07-215.rawproto


您可能遇到了用户/组权限问题。尝试查看Jenkins用户是否有权在该文件夹中进行更改(因为Jenkins具有不同的用户)。

关于android - 无法在 Jenkins 建立gradle,无法创建类型的服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44635605/

相关文章:

Jenkins 和 Kubernetes 与 Helm 的集成

java - 错误 : cannot find symbol in gradle compileTestJava

java - Android:getParcelable 返回 null?

android - Hilt ClassCastException : ViewComponentManager$FragmentContextWrapper cannot be cast to AppCompatActivity

eclipse - 我如何配置mylyn jenkins?

Java QueryDSL 和 Gradle Kotlin DSL

Gradle 预编译脚本插件失败,第一个 block 为 `expression ... cannot be invoked as a function`

android - BLE gatt.discoverServices() 返回 true 但回调永远不会触发

android - 2个不同的应用程序可以同时使用同一个相机吗?

java - 使用 SonarQube 分析 Java 项目时以及在单元测试源代码中激活规则跟踪质量问题时出现 NullPointerException