本文介绍了NoClassDefFoundError的只有Android 2.1系统,采用番石榴库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了使用番石榴库中的Andr​​oid应用程序。

I wrote an Android app that use the Guava library.

该应用程序工作完全正常在Android 4(虚拟机和真实的设备)。

The app works perfectly fine on Android 4 (virtual machine and real device).

然而,当我尝试推出运行Android 2.1的虚拟机上的应用程序,我得到以下错误:

However, when I try to launch the app on a virtual machine running Android 2.1, I get the following error:

java.lang.NoClassDefFoundError: com.google.common.collect.ImmutableSortedMap

我打的库进口。背后的想法:机器人的旧版本可能会以不同的方式处理罐。这里没有成功。

I have played with the libraries imports. The idea behind: older version of Android might handle jars in a different way. No success here.

值得一提的是,该应用程序是已经使用番石榴一个previous版本的更新。在previous版本工作得很好上的所有设备,但不使用ImmutableSortedMap对象,而只是一个ImmutableList。
有没有可能,手机加载自己的番石榴库版本(可能不包含ImmutableSortedMap)?

It is worth mentioning, that the app is an update of a previous version already using Guava. The previous version worked fine on all devices, but wasn't using the ImmutableSortedMap object rather just an ImmutableList.Would it be possible that the phone is loading his own version of the Guava library (that might not contains ImmutableSortedMap)?

我使用Eclipse ADT与20这是我的图书馆怎么看起来像在Ec​​lipse包浏览器:

I am using Eclipse with ADT 20. Here is how my libraries looks like in Eclipse package explorer:

感谢你在前进!

推荐答案

您可能需要使用的的。番石榴的新版本, ImmutableSortedMap 工具的NavigableMap ,这是在JDK6介绍。 的NavigableMap 在早期版本的Andr​​oid不支持 - 具体包括2.1; 的NavigableMap 发布了Android作为的Andr​​oid 2.3姜饼,它看起来像。

You probably need to be using the guava-jdk5 back port. In newer versions of Guava, ImmutableSortedMap implements NavigableMap, which was introduced in JDK6. NavigableMap is not supported in earlier versions of Android -- specifically including 2.1; NavigableMap was released on Android as of Android 2.3 Gingerbread, it looks like.

(在反向移植, ImmutableSortedMap 支持所有的的NavigableMap 办法;它只是没有真正实施的NavigableMap

(In the backport, ImmutableSortedMap supports all the NavigableMap methods; it just doesn't actually implement NavigableMap.)

这篇关于NoClassDefFoundError的只有Android 2.1系统,采用番石榴库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 09:36