我有一个包含两个模块的项目。
第一个模块(库模块)具有以下依赖关系:
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'
}
第二个模块(app 模块)有这些:
dependencies {
compile 'com.android.support:appcompat-v7:25.1.1'
compile project(":library-module-above")
}
这是我的 .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
Travis 上的构建失败,因为它找不到支持 api(
RecyclerView
, LayoutManager
,支持注释)。如果我在本地机器上运行相同的命令(
./gradlew build connectedCheck --stacktrace
),构建通过,发现所有符号时出现 0 个错误。我的 Travis 组件是否正确?或者还有什么我错过的?
编辑
关于“找不到符号”的错误并没有停止构建。
我没有注意到有关许可证的错误:
* 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].
我在答案中写了解决方案。
最佳答案
我解决了它添加另一个 tools
零件。
我在 Travis Github 的官方页面上找到了解决方案。
这里:https://github.com/travis-ci/docs-travis-ci-com/issues/779
在这里:https://github.com/travis-ci/travis-ci/issues/6801
我的期末 .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
现在一切正常。
关于android - Travis CI 因支持依赖而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42178482/