默认Jenkins没有设置Android SDK环境的选项,所以构建App时会报错。 报错信息如下:
01:52:21.861 [INFO] [org.gradle.api.Project] Parsing the SDK, no caching allowed
01:52:21.872 [ERROR] [org.gradle.BuildExceptionReporter]
01:52:21.873 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
01:52:21.873 [ERROR] [org.gradle.BuildExceptionReporter]
01:52:21.874 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
01:52:21.874 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred configuring project ':app'.
01:52:21.874 [ERROR] [org.gradle.BuildExceptionReporter] > SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
01:52:21.874 [ERROR] [org.gradle.BuildExceptionReporter]
01:52:21.875 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
01:52:21.875 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
01:52:21.876 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
01:52:21.876 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)
01:52:21.876 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
01:52:21.876 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:540)
01:52:21.876 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:93)
01:52:21.876 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:47)
01:52:21.876 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
01:52:21.876 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:124)
01:52:21.877 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Factories$1.create(Factories.java:22)
01:52:21.877 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
01:52:21.877 [ERROR] [org.gradle.BuildExceptionReporter] at
我们设置一个环境变量即可。 点击左边的系统管理——>系统设置——>找到全局属性——>点击添加勾选环境变量 其中键必须要为ANDROID_HOME,值为sdk绝对路径。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/2063.html