Travis CI for Android - Build Error: Failed to find target & Could not find dependencies

若如初见. 提交于 2019-12-07 05:02:31

问题


I am trying to set up Travis CI for my existing Android project. I've added the .travis.yml:

language: android
android:
  components:
    - build-tools-21.1.2
    - android-22
    - extra-google-google_play_services

But it always fails in Travis CI with the following error:

FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':evercamPlay'.
failed to find target android-22 : /usr/local/android-sdk
* 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: 16.801 secs
The command "./gradlew build connectedCheck" exited with 1.
Done. Your build exited with 1.

What should I do to get rid of this error?


Update:
After updating build tools to version 22.0.1, this error is gone but got new error:

> Could not find com.android.support:support-v4:22.2.0.
...
> Could not find com.google.android.gms:play-services:7.3.0.
...

In my build.gradle:

dependencies {
    compile 'com.android.support:support-v4:22.2.0'
    compile 'com.google.android.gms:play-services:7.3.0'
}

Any idea how to fix this?

Thanks!


回答1:


You need to update the build tools to the version 22.X, I have tried in my project configuration and that works.

android:
  components:
    - android-22
    - build-tools-22.0.1



回答2:


It's also possible that Travis hasn't been updated with the appropriate sdks yet. From their docs (as of June 9, 2015):

Pre-installed components #

While the following components are preinstalled, the exact list may change without prior notice. To ensure the stability of your build environment, we recommend that you explicitly specify the required components for your project.

  • platform-tools
  • build-tools-21.1.1
  • android-21
  • sys-img-armeabi-v7a-android-21
  • android-20
  • sys-img-armeabi-v7a-android-wear-20
  • android-19
  • sys-img-armeabi-v7a-android-19
  • android-18
  • sys-img-armeabi-v7a-android-18
  • android-17
  • sys-img-armeabi-v7a-android-17
  • android-16
  • sys-img-armeabi-v7a-android-16
  • android-15
  • sys-img-armeabi-v7a-android-15
  • android-10
  • extra-android-support
  • extra-google-google_play_services
  • extra-google-m2repository
  • extra-android-m2repository

No mention of v22 sdk or build tools there.




回答3:


language: android
    android:
      components:
        - platform-tool
        - tool
        - android-22
        - build-tools-22.0.1
        - extra-android-m2repository
        - extra-google-m2repository


来源:https://stackoverflow.com/questions/30729943/travis-ci-for-android-build-error-failed-to-find-target-could-not-find-depe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!