问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/31164683/travisci-android-build-fails-only-on-ci-not-locally