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).