找不到android的sdk,CircleCI – 找不到Android Studio项目的SDK位置

尝试在CircleCI上构建项目时,在gradle构建期间发生以下错误.这个问题的原因是什么?我正在运行CircleCI 2.0.

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.

>尝试:使用–stacktrace选项运行以获取堆栈跟踪.使用–info或–debug选项运行以获取更多日志输出.

>在https://help.gradle.org获得更多帮助

在18s建立失败退出代码1

这是我的config.yml看起来像:

# 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

解决方法:

CircleCI for Android提供了一个sample configuration,它可以处理您遇到的SDK问题.我不确定为什么他们在设置新项目时不会显示此选项.

基本上,当您设置一个新项目以遵循CircleCI时,您可能选择了Gradle(Java)选项.这并不专门针对Android,所以这就是为什么它抱怨缺少SDK.

上面链接的示例配置如下所示(最重要的部分是指定的docker镜像,CircleCI文档很好地解释了每行的作用):

version: 2

jobs:

build:

working_directory: ~/code

docker:

- image: circleci/android:api-25-alpha

environment:

JVM_OPTS: -Xmx3200m

steps:

- checkout

- restore_cache:

key: jars-{{ checksum "build.gradle" }}-{{ checksum

"app/build.gradle" }}

- run:

name: Download Dependencies

command: ./gradlew androidDependencies

- save_cache:

paths:

- ~/.gradle

key: jars-{{ checksum "build.gradle" }}-{{ checksum

"app/build.gradle" }}

- run:

name: Run Tests

command: ./gradlew lint test

- store_artifacts:

path: app/build/reports

destination: reports

- store_test_results:

path: app/build/test-results

希望你尽快建立好!

标签:android,circleci

来源: https://codeday.me/bug/20190727/1551060.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值