I'm having troubles building an Android project with Gradle on Travis CI.
I have declared my dependencies like this on my build.gradle:
dependencies {
compile 'com.android.support:appcompat-v7:18.0.0'
compile 'com.android.support:support-v4:18.0.0'
freeCompile files (
'libs/GoogleAdMobAdsSdk-6.4.1.jar'
)
}
This is my .travis.yml script:
script:
- TERM=dumb ./gradlew build
- TERM=dumb ./gradlew connectedInstrumentTest
And I'm getting this on Travis:
A problem occurred configuring project ':FlavorTest'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':FlavorTest:_FreeDebugCompile'.
> Could not find com.android.support:appcompat-v7:18.0.0.
Required by:
cloaked-octo-spice:FlavorTest:unspecified
> Could not find com.android.support:support-v4:18.0.0.
Required by:
cloaked-octo-spice:FlavorTest:unspecified
On my local project all seems to work fine. I need to do something else in order to get the dependencies on Travis?
Thanks for the help in advance.
I got this solved with some help. It seems that Gradle couldn't find the Android Support dependencies on the local repository, those needed to be installed with the following command:
android update sdk --filter extra-android-support --no-ui --force > /dev/null
android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
You can check my .travis.yml file on this public repository (https://github.com/Ruenzuo/cloaked-octo-cyril), hope this helps someone else.
An easier way:
android:
components:
- extra-android-m2repository
You must remeber to accept the license. For example adding:
android:
licenses:
- android-sdk-license-.+
The answer above is correct. I just thought it'd be worth posting another solution with a travis.yml example. You can find a good one at Pestrada's github site: https://github.com/pestrada/android-tdd-playground/blob/master/.travis.yml
The relevant lines are:
# Install required components.
# For a full list, run `android list sdk -a --extended`
# Note that sysimg-18 downloads the ARM, x86 and MIPS images (we should optimize this).
# Other relevant API's
- echo yes | android update sdk --filter platform-tools --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-18 --no-ui --force > /dev/null
- echo yes | android update sdk --filter android-19 --no-ui --force > /dev/null
- echo yes | android update sdk --filter sysimg-19 --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With