当我在本地使用Gradle构建这个项目时,我得到了一个成功的构建。但是,在我的.yml文件中,构建在CI管道中失败:
image: java:8-jdk
stages:
- build
- test
- code-analysis
before_script:
# - echo `pwd` # debug
# - echo "$CI_BUILD_NAME, $CI_COMMIT_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文件中实现这一点?
发布于 2021-05-02 12:11:52
现在您正在使用java-8JDK映像,而且这里没有安装android。有两种方法可以让码头映像中安装所需的一切:
解决当前问题的最快方法是用image: java:8-jdk替换image: javiersantos/android-ci:28.0.3
https://stackoverflow.com/questions/67321601
复制相似问题