TravisCI Android build fails only on CI not locally
Asked Answered
A

1

2

I have got a strange error and cannot find a solution:

* What went wrong:
Execution failed for task ':app:compileDebugAndroidTestGroovy'.
> Unable to load class de.rheinfabrik.mvvm_example.activities.DetailsActivity due to missing dependency android/support/v4/view/LayoutInflaterFactory

But it´s impossible. This project works locally. Also the dependency is there.

Here my .travis.yml

language: android
jdk: oraclejdk8
env:
  matrix:
   - ANDROID_TARGET=android-22  ANDROID_ABI=armeabi-v7a
  global:
  - TERM=dumb

android:
  components:
    - build-tools-21.1.2
    - android-22
    - sys-img-armeabi-v7a-android-22
    - extra

# Emulator Management: Create, Start and Wait
before_script:
  - echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
  - emulator -avd test -no-skin -no-audio -no-window &
  - android-wait-for-emulator
  - adb shell input keyevent 82 &

script: cd MVVM-Example && ./gradlew app:connectAndroidTest --stacktrace -PdisablePreDex

Anyone have an idea why the dependency LayoutInflaterFactory is missing?

https://travis-ci.org/AHarazim/android-mvvm-example

Artemas answered 1/7, 2015 at 14:47 Comment(5)
You have major versioning issues. Target API 22, make sure your build tools are 22.0.1. Please make sure your dependencies are upgraded to 22.2.0, here: github.com/AHarazim/android-mvvm-example/blob/master/…. And you are missing - extra-android-m2repository from the .travis.yml.Wieldy
@JaredBurrows I´ve updated to the latest build-tools but still doesn´t work.Artemas
@JaredBurrows The builds are running under the devTravisCi-Branch... And if I write - extra then all extras will be updated including m2repository.Artemas
You are just now commenting after all this time? You do not even have your .travis.yml file in your repo.Wieldy
Sry, I was on holiday. FYI I have a .travis.yml file on the devTravisCi branch and not on the master branch.Artemas
R
2

Try

- build-tools-22.0.1

http://developer.android.com/tools/revisions/build-tools.html

Build Tools, Revision 22.0.0 (March 2015) Added support for Android 5.1 (API level 22).

And I think that is connectedAndroidTest.

Update, try to get latest tools versions, Travis-ci reverted the last VM update, good luck, if this doesn't work, I don't know another possible reason:

language: android
    android:
      components:
        - platform-tool
        - tool
        - android-22
        - build-tools-22.0.1
        - extra-android-m2repository
        - extra-google-m2repository
        - sys-img-armeabi-v7a-android-22

Update2: I forked your project, tried my suggestions and it didn't work. But I followed a discussion about to add

retrolambda {
  jvmArgs '-noverify'
}

As you already did. And there was this variant, I didn't read it and rushed to the solution and works :)

script: 
  - cd MVVM-Example
  - ./gradlew prepareDebugDependencies
  - ./gradlew assembleDebug # you can run clean before assemble
  - ./gradlew app:connectedAndroidTest --info

I'm not familiar with this retrolambda stuff, please explain the solution for other if it works for you, I thought that it was a simple travis issue.

Roe answered 2/7, 2015 at 22:35 Comment(5)
And I'm not sure if Android supports jdk8 groups.google.com/forum/#!topic/adt-dev/kVku6XfiQx4Roe
The JDK should be fine, see github.com/robolectric/deckard-gradle/blob/master/.travis.ymlWieldy
@Ardock The JDK works locally perfect. I have updated everything, but still fails :-(Artemas
Nice that JDK8 is supported. I updated my response as a last try. If that doesn't work, try android-21, I don't know the reason.Roe
@Ardock Awesome! Thanks your solution from Update2 works for me!Artemas

© 2022 - 2024 — McMap. All rights reserved.