【发布时间】:2021-04-29 16:38:51
【问题描述】:
当我使用 Gradle 在本地构建这个项目时,我获得了成功的构建。但是,在我的 .yml 文件中,CI 管道中的构建失败:
image: java:8-jdk
stages:
- build
- test
- code-analysis
before_script:
# - echo `pwd` # debug
# - echo "$CI_BUILD_NAME, $CI_BUILD_REF_NAME $CI_BUILD_STAGE" # debug
- export GRADLE_USER_HOME=`pwd`/.gradle
- chmod +x gradlew
cache:
paths:
- .gradle/wrapper
- .gradle/caches
build:
stage: build
script:
- ./gradlew clean build
test:
stage: test
script:
- ./gradlew test
lint:
stage: code-analysis
script:
./gradlew lint
checkstyle:
stage: code-analysis
script:
./gradlew checkstyle
pmd:
stage: code-analysis
script:
./gradlew pmd
这是管道构建阶段的错误消息:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:assemble'.
> Could not create task ':app:assembleRelease'.
> Could not create task ':app:lintVitalRelease'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file.
我该如何解决这个问题?我需要全局设置 sdk 位置吗?我需要清除缓存吗?如果是这样,我如何在 .yml 文件中实现这一点?
【问题讨论】:
标签: java android-studio gradle sdk continuous-integration