尝试在CircleCI上构建项目时,在gradle构建期间发生以下错误 . 这个问题的原因是什么?我正在运行 CircleCI 2.0 .
FAILURE:构建因异常而失败 . 出了什么问题:配置项目':app'时出现问题 . 找不到SDK位置 . 使用sdk.dir在local.properties文件中或使用ANDROID_HOME环境变量定义位置 . 尝试:使用--stacktrace选项运行以获取堆栈跟踪 . 使用--info或--debug选项运行以获取更多日志输出 . 在https://help.gradle.org获取更多帮助 . 在18s内 Build 失败退出代码1
This is what my config.yml looks like:
# Java Gradle CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
working_directory: ~/repo
environment:
# Customize the JVM maximum heap limit
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: gradle dependencies
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "build.gradle" }}
# run tests!
- run: gradle test
2 回答
有一个_C91869_由CircleCI for Android提供,它处理你的SDK问题're running into. I'我不知道为什么他们在设置一个新项目时不会显示这个选项 .
基本上,当您设置一个新项目以遵循CircleCI时,您可能选择了Gradle(Java)选项 . 这并不专门针对Android,所以这就是为什么它抱怨缺少SDK .
上面链接的示例配置如下所示(最重要的部分是指定的docker镜像,CircleCI文档很好地解释了每行的作用):
希望你尽快 Build 好!
我用过这个,它对我有用 . 最初一直有索引问题 . 代码未正确编入索引 . 这可能是某人的问题