我在 Gitlab 上有一个Android项目,我正在尝试设置Gitlab提供的持续集成。 但是,构建不断失败。
我检查了settings.gradle
文件,它看起来像建议的一样。
我什至在项目的根文件夹中添加了一个local.properties
文件,但这也不能解决问题。
我什至创建了一个ANDROID_HOME
环境变量,但同样的错误也会发生。
我目前已从Gitlab删除local.properties
文件,因为此处的一些用户建议该版本将自动使用环境变量。
这是我的文件:
.gitlab-ci.yml
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "27"
ANDROID_BUILD_TOOLS: "28.0.2"
ANDROID_SDK_TOOLS: "4333796"
before_script:
- echo "Building..."
stages:
- build
build:
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
这是一个非常简单的构建脚本,因为我是这个概念的新手,我只是想暂时使某些东西起作用。请指出是否有任何问题。
settings.gradle
include ':app'
local.properties
sdk.dir=C\:\\Users\\User\\AppData\\Local\\Android\\sdk
ANDROID_HOME
-
C:\Users\User\AppData\Local\Android\sdk
如果有人至少可以帮助我获取堆栈跟踪信息,我将不胜感激。
这是构建失败消息:
Using Shell executor...
Running on DESKTOP-P93CLOP...
DEPRECATION: this GitLab server doesn't support refspecs, gitlab-runner 12.0 will no longer work with this version of GitLab
Cloning repository...
Cloning into 'C:/Users/User/Gitlab-Runner/builds/4ef6ac99/0/username/ICR'...
Checking out 2783d0fb as master...
Skipping Git submodules setup
$ echo "Building..."
"Building..."
$ ./gradlew assembleDebug
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
ERROR: Job failed: exit status 1