简体   繁体   English

Travis CI因支持依赖性而失败

[英]Travis CI fails with support dependencies

I have a project with two modules. 我有一个包含两个模块的项目。 The first module (the library module) has these dependencies: 第一个模块(库模块)具有以下依赖关系:

dependencies {
    compile 'com.android.support:support-annotations:25.1.1'
    compile 'com.android.support:support-v4:25.1.1'
    compile 'com.android.support:recyclerview-v7:25.1.1'
}

The second module (the app module) has these ones: 第二个模块(app模块)具有以下功能:

dependencies {
    compile 'com.android.support:appcompat-v7:25.1.1'
    compile project(":library-module-above")
}

This is my .travis.yml file: 这是我的.travis.yml文件:

language: android
jdk: oraclejdk8

android:
  components:
    - tools
    - platform-tools
    - build-tools-25.0.2
    - android-25
    - extra-android-m2repository
    - extra-google-m2repository
    - extra-android-support

branches:
  only:
    - master

script:
  - ./gradlew build connectedCheck --stacktrace

before_cache:
  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
  directories:
    - $HOME/.gradle/caches/
    - $HOME/.gradle/wrapper/
    - $HOME/.android/build-cache

The build on Travis fails because it cannot find support apis ( RecyclerView , LayoutManager , support annotations). Travis上的构建失败,因为它找不到支持API( RecyclerViewLayoutManager ,支持批注)。

If I run the same command ( ./gradlew build connectedCheck --stacktrace ) on my local machine, the build passes with 0 errors finding all symbols. 如果我在本地计算机上运行相同的命令( ./gradlew build connectedCheck --stacktrace ),则构建会通过0错误,查找所有符号。

Are my Travis components corrects? 我的Travis组件是否正确? Or there's something else I've missed? 还是我想念的其他东西?

EDIT 编辑

The errors about "cannot find symbols" didn't stop the build. 关于“找不到符号”的错误并未停止构建。 I've didn't notice the error about licenses: 我没有注意到有关许可证的错误:

* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
  [Android SDK Build-Tools 25.0.2, Android SDK Platform 25].

I wrote the solution in the answers. 我在答案中写了解决方案。

I solved it adding another tools component. 我添加了另一个tools组件来解决它。 I found the solution on the official Travis Github's page. 我在Travis Github的官方页面上找到了解决方案。

Here: https://github.com/travis-ci/docs-travis-ci-com/issues/779 此处: https//github.com/travis-ci/docs-travis-ci-com/issues/779

And here: https://github.com/travis-ci/travis-ci/issues/6801 而在这里: https : //github.com/travis-ci/travis-ci/issues/6801

My final .travis.yml components are: 我最后的.travis.yml组件是:

components:
  - tools
  - platform-tools
  - tools # used above api 25.x
  - build-tools-25.0.2
  - android-25
  - extra-android-support
  - extra-android-m2repository
  - extra-google-m2repository

Now everything works correctly. 现在一切正常。

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

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