大厦的Andr​​oid Studio项目上詹金斯? android.compileSdkVersion缺失 [英] Building Android Studio project on Jenkins? android.compileSdkVersion is missing

查看:452
本文介绍了大厦的Andr​​oid Studio项目上詹金斯? android.compileSdkVersion缺失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立我的第一个Android项目的基础上詹金斯。

I'm trying to set up my first Android project to build on Jenkins.

我运行詹金斯1.6.2的摇篮插件的1.24版本。运行在Windows 7专业版SP1。

I'm running Jenkins 1.6.2 with version 1.24 of the Gradle plugin. Running on Windows 7 Professional SP1.

我已经在我的构建机器安装的Andr​​oid Studio和java7目录JDK和软件的检出版本构建就好了,通过Android的工作室。但我不能得到调用摇篮脚本生成任务的工作,我的詹金斯作业中。

I've installed Android Studio and the Java7 JDK on my build machine, and a checked-out version of the software builds just fine, through Android Studio or when running gradlew.bat from the command line. But I can't get the Invoke Gradle script build task to work, within my Jenkins job.

有一对单选按钮,配置项目主页上:

There is a pair of radio buttons, on the configure project page:

  • 调用摇篮
  • 使用摇篮包装

如果我选择调用摇篮,有人问我选择了摇篮版本,这是在配置系统这是我的设置。

If I select "Invoke Gradle", I'm asked to select a "Gradle Version", which is something I setup in Configure System.

我创建了一个摇篮的安装与GRADLE_HOME设置为D:\ Program Files文件\ Android的工作室\摇篮\摇篮-2.2.1。这给了我一个警告,D:\ Program Files文件\ Android的工作室\摇篮\摇篮-2.2.1是不是就詹金斯主....目录

I created a gradle installation with GRADLE_HOME set to "D:\Program Files\Android Studio\gradle\gradle-2.2.1". That gives me a warning that "D:\Program Files\Android Studio\gradle\gradle-2.2.1 is not a directory on the Jenkins master...."

当我运行一个版本,我得到一个错误无法检索摇篮的可执行文件。

And when I run a build, I get an error "Can't retrieve the Gradle executable".

这可能是相关的摇篮插件抱怨目录。但该目录是正确的。我试着用'/',而不是'\',它并没有区别。

Which is probably related to the gradle plugin complaining about the directory. But the directory is correct. I've tried it with '/' instead of '\', and it made no difference.

由于没有工作,我尝试了选择,使用摇篮包装。有一个复选框:从根构建脚本目录。无论我检查一下,还是不行,我得java.lang.IllegalArgumentException:如果!android.compileSdkVersion缺少

Since that didn't work, I tried the alternative, "Use Gradle Wrapper". There's a checkbox: "From Root Build Script Dir". Whether I check it, or not, I get "java.lang.IllegalArgumentException: android.compileSdkVersion is missing!"

我一直都设置JAVA_HOME和ANDROID_HOME,所以这不是问题。

I've set both JAVA_HOME and ANDROID_HOME, so that's not the issue.

任何想法?

作为后续,我删除了摇篮的任务,并增加了执行Windows批处理命令的任务:

As a followup, I delete the gradle task, and added an Execute Windows batch command task:

SET ANDROID_HOME=d:\Program Files\Android\sdk
SET JAVA_HOME=d:\Program Files\Java\jdk1.7.0_79

.\gradlew.bat clean

当我跑,我仍然得到这个错误。

When I run that, I still get that error.

但是当我运行这些命令从生成计算机上的命令行,他们的工作就好了。

But when I run those commands from a command line on the build machine, they work just fine.

还有什么不同,从詹金斯运行gradlew.bat时,不是通过命令行运行的时候吗?詹金斯服务配置为使用为我登录的同一个用户,当我在命令行中运行。我尝试过明确设置每个我已经在命令行设置各种环境变量,在詹金斯的任务,我仍然看到了错误。

What could be different, when running gradlew.bat from Jenkins, than when running it from the command line? The Jenkins service is configured to use the same user as I'm logged in as, when I'm running from the command line. I've tried explicitly setting each and every environment variable I have set in the command line, in the Jenkins task, and I'm still seeing the error.

任何想法?

推荐答案

您local.properties文件必须包含: sdk.dir =路径到你的Andr​​oid SDK中

Your local.properties file must contain: sdk.dir="path to your android sdk"

这篇关于大厦的Andr​​oid Studio项目上詹金斯? android.compileSdkVersion缺失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆