Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CircleCI-未找到Android Studio项目的SDK位置_Android_Circleci - Fatal编程技术网

CircleCI-未找到Android Studio项目的SDK位置

CircleCI-未找到Android Studio项目的SDK位置,android,circleci,Android,Circleci,尝试在CircleCI上构建项目时,在gradle构建过程中发生以下错误。这个问题的原因是什么?我正在运行CircleCI 2.0 失败:生成失败,出现异常 错误:配置项目“:app”时出现问题 未找到SDK位置。使用local.properties文件中的sdk.dir或ANDROID_HOME环境变量定义位置 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出 得到更多的帮助 生成在18秒内失败,已退出,代码为1 这就是

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

失败:生成失败,出现异常

  • 错误:配置项目“:app”时出现问题

    未找到SDK位置。使用local.properties文件中的sdk.dir或ANDROID_HOME环境变量定义位置

  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出

  • 得到更多的帮助

生成在18秒内失败,已退出,代码为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为Android提供了一个解决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: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
     command: sudo chmod +x ./gradlew
  - 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

谢谢,这对我有用。我还必须取消对文件中权限部分的注释:
#-run:#name:Chmod permissions#如果对Gradlew依赖项的权限失败,请使用此选项。#命令:sudo chmod+x./gradlew
对于我来说,我收到了这个错误,配置错误:发生了2个错误:*错误解析配置文件:yaml:第17行:找不到预期的“:”*找不到名为
build
的作业以在配置文件的
jobs:
部分运行。如果您希望工作流运行,请检查您的配置是否包含名为“workflows:”的顶级键Hey@SreedevR,听起来您的config.yml文件可能不正确。你有链接让我看一下吗?
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: Chmod permissions #if permission for Gradlew Dependencies fail, use this.
     command: sudo chmod +x ./gradlew
  - 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