当前位置: 首页 > 工具软件 > circleci-docs > 使用案例 >

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

刘博文
2023-12-01

尝试在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

 类似资料: