简体   繁体   English

Travis CI构建失败./gradlew汇编

[英]Travis CI build failed ./gradlew assemble

I'm trying to build project with Travis CI and Codecov, but I'm getting this error when I build with Travis CI 我正在尝试使用Travis CI和Codecov构建项目,但是当我使用Travis CI构建时出现此错误

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.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 31.202 secs

The command "eval ./gradlew assemble" failed. Retrying, 2 of 3.

This is my .travis.yml 这是我的.travis.yml

language: java

jdk:
  - oraclejdk8

sudo: required

before_install:
 - chmod +x gradlew

script:
  - ./gradlew clean build -i --continue

after_success:
  - bash <(curl -s https://codecov.io/bash) -t myToken

I've read this a lot about before_install but it doesn't change anything... 我已经阅读了很多关于before_install但它没有改变任何东西......

You should set your "language" to android in your .travis.yml file as described in the link below. 您应该在.travis.yml文件中将“语言”设置为android,如下面的链接所述。

Referring to the Travis documentation here: Building an Android Project 请参阅此处的Travis文档: 构建Android项目

You could try writing below line in travis file 你可以尝试在travis文件中写下面的行

jdk: openjdk8 jdk:openjdk8

You can check the difference between oracle JDK and Open Jdk though. 您可以检查oracle JDK和Open Jdk之间的区别。 It should not matter as both are licenced one from oracle and one from open GNU PL but if you want specific difference you could visit - https://www.baeldung.com/oracle-jdk-vs-openjdk 它应该没有关系,因为它们都是来自oracle和开放GNU PL的许可,但是如果你想要特定的差异你可以访问 - https://www.baeldung.com/oracle-jdk-vs-openjdk

I solved with this: 我用这个解决了:

language: android
sudo: false

before_script:
  - echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a
  - emulator -avd test -no-skin -no-audio -no-window &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &

android:
  components:
    # Update Android SDK Tools
    - tools

    - build-tools-25.0.1
    - android-25

    # Support library
    - extra-android-support
    - extra-android-m2repository

jdk:
  - oraclejdk8

sudo: required

before_install:
 - chmod +x gradlew

after_success:
  - bash <(curl -s https://codecov.io/bash) -t token

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM