1

我正在java.lang.NoClassDefFoundError: com.google.common.collect.SortedMultisets$NavigableElementSet使用Android 2.2设备。

我在 Android 2.2 模拟器上遇到了同样的崩溃

不过,我在Android 4.x设备上没有收到该错误。

我的build.gradle有:

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

defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
}

为什么会这样?

4

2 回答 2

2

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

于 2014-01-29T17:51:54.347 回答
0

我在这里找到了答案http://porcupineprogrammer.blogspot.com/2013/06/guava-and-minsdkversion.html

原来只有 Guava 13 和更早的版本可以在 Android 2.2 上正常工作。

我已经降级到 Guava 13。

于 2014-01-29T16:11:47.250 回答