Jenkins 提供的 SDK 目录不存在

时间:2023-01-31
本文介绍了Jenkins 提供的 SDK 目录不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在尝试在 android gradle 项目上设置与 Jenkins 的持续集成

I'm trying to setup continuous integration with Jenkins on an android gradle project

当我构建它时,我收到以下错误:

When I build it, I get the following error:

[Android Gradle Jenkins Experiment2] $ "/Users/Shared/Jenkins/Home/workspace/Android Gradle Jenkins Experiment2/gradlew" build
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
The SDK directory '/Users/chaz/Library/Android/sdk' does not exist.

以下是我的jenkins配置的一部分:

The following is part of my jenkins configuration:

ANDROID_HOME
/Users/chaz/Library/Android/sdk

JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/

我的机器是OS X El Capitan 10.11.6版

我尝试了以下方法:

  1. 认为是权限问题,给sdk目录下chmod -R 777
  2. 仔细检查 local.properties 文件中的 sdk.dir(它指向 /Users/chaz/Library/Android/sdk).
  3. 从 jenkins 配置中删除了添加回来的 ANDROID_HOME env 变量(没有帮助).
  1. Thinking it is a permission issue, gave chmod -R 777 for the sdk directory
  2. Double checked the sdk.dir in local.properties file (It is pointing to /Users/chaz/Library/Android/sdk).
  3. Removed added back ANDROID_HOME env variable from within jenkins configuration (didn't help).

当我用谷歌搜索时,我发现有人面临同样的问题.提供的解决方案如下:

When I googled, I found someone faced the same issue. And the solution provided was as follows:

解决方案

这很可能发生,因为您正在覆盖 ANDROID_HOME —删除这样的环境自定义,然后 SDK 应该安装好.

That's most likely happening because you're overriding ANDROID_HOME — remove environment customisations like that and then the SDK should install fine.

致谢

谢谢,是的,它是 env 变量的重叠.我已经删除了除全局之外的所有内容并将其保存在 ${ANDROID_HOME} 中.

Thanks and yeah, it was overlapping of env variables. I have removed all except the global one and kept it in ${ANDROID_HOME}.

我应该如何做除了全局之外的所有内容并将其保存在 ${ANDROID_HOME} 中. 解决方案的一部分?

How should I do the all except the global one and kept it in ${ANDROID_HOME}. part of the solution?

我能够在具有相同 jenkins 配置的 Windows 机器上成功使用 Jenkins(我能够成功构建,也在设备中安装 apk).

I was successfully able to use Jenkins on a windows machine with same jenkins configuration (I was able to build successfully, install apk in a device too).

提前致谢!

推荐答案

这听起来像是权限问题.您可能已授予 sdk-dir 权限,但未授予父目录权限.

This smells like a permission problem. You might have given permission to the sdk-dir but not the parent directory.

这篇关于Jenkins 提供的 SDK 目录不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:为什么 Android 在 Gradle 依赖项中将“编译"配置更改为“实现"配置? 下一篇:Android:使用哪一个作为包名?清单的包名或 Gradle applicationId?

相关文章

最新文章