문제

I'm getting java.lang.NoClassDefFoundError: com.google.common.collect.SortedMultisets$NavigableElementSet on Android 2.2 devices.

I'm getting the same crash on Android 2.2 emulator

I'm not getting that error on Android 4.x devices though.

My build.gradle has:

dependencies {
compile group: 'com.google.guava', name: 'guava', version: '15.0'
}

defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
}

Why is this happening?

도움이 되었습니까?

해결책

If you want to use newer version of Guava (which you should), use Guava JDK5 backport (it will work with Android 2.2). Also, see this answer explaining what's going on (some classes/interfaces Guava uses are not supported in Android 2.1-2.2).

Note that currently there's no guava-jdk5-15.0 release (and it probably won't be) but guava-jdk5-16.0 is on its way (see comments in this G+ post).

다른 팁

I've found the answer here http://porcupineprogrammer.blogspot.com/2013/06/guava-and-minsdkversion.html.

Turns out only Guava 13 and earlier work properly with Android 2.2.

I've downgraded to Guava 13.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top