ActionBarSherlock +地图+装载机= java.lang.NoClassDefFoundError的 [英] ActionBarSherlock + Maps + Loaders = java.lang.NoClassDefFoundError

查看:178
本文介绍了ActionBarSherlock +地图+装载机= java.lang.NoClassDefFoundError的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:有关详细操作方法,请我的回答

For a detailed how-to, check out my answer.

我挣扎了两天了,希望有人能帮助。

I'm struggling with it for two days now, hope someone can help.

我想使用最新的ActionBarSherlock(4.0)与图形页面。我知道它的问题与碎片,但我并不需要他们在本次活动。但我需要装载机和它的出现,是用装载机我不得不延长FragmentActivity了。没问题,我想,我们从皮特·道尔的 Android的支持-V4-的GoogleMaps 。至于建议就多那么线程和谷歌群组我建立了Android支持-V4-的GoogleMaps JAR(Android的支持-V13-R7-googlemaps.jar实际上),而不是Android的支持,v4.jar的ABS。然后,我用它作为我的项目库。

I'm trying to use the newest ActionBarSherlock (4.0) with a MapView. I knew it's problematic with fragments, but I don't need them in this activity. But I need Loaders and it appears, that to use Loaders I have to extend the FragmentActivity too. No problem, I thought, we have the android-support-v4-googlemaps from Pete Doyle. As suggested on many SO threads and Google Groups I build the ABS with android-support-v4-googlemaps JAR (android-support-v13-r7-googlemaps.jar actually) instead of android-support-v4.jar. Then I used it as a library for my project.

现在,我想有我的活动是这样的:

公共类BananoutMapActivity扩展SherlockFragmentActivity实现LoaderCallbacks< ArrayList的< EventItem>> {

的问题:

汇编,而是抛出一个运行时错误: E / AndroidRuntime(29159):java.lang.NoClassDefFoundError的:ndl.klimczak.bananout.BananoutMapActivity

It compiles, but throws a runtime error: E/AndroidRuntime(29159): java.lang.NoClassDefFoundError: ndl.klimczak.bananout.BananoutMapActivity

我三重检查事情:

  • 在两个ActionBarSherlock库项目,我的项目是针对谷歌的API 4.0.3
  • <使用库机器人:名称=com.google.android.maps/> ,我必须在应用程序标记
  • 我也有同样的Andr​​oid的支持-V13-R7-googlemaps.jar在我的项目的构建路径
  • .BananoutMapActivity 在我的清单
  • 声明
  • both ActionBarSherlock library project and my project are targeted at Google APIs 4.0.3
  • I have <uses-library android:name="com.google.android.maps" /> and I have it in the application tag.
  • I also have the same android-support-v13-r7-googlemaps.jar in the build path of my project
  • I have .BananoutMapActivity declared in my manifest

什么是有趣的:

  • 当我在一个ICS模拟器它的工作原理运行(出现错误。2. *模拟器和我的2.3.7的设备),在蜂窝,将工作太可能,这是用我猜ACL的问题

  • When I run it on an ICS emulator it works (the error appears on 2.* emulators and my 2.3.7 device), on Honeycomb it would work too probably, it's the question of using the ACL I guess

当我删除实现LoaderCallbacks&LT; ArrayList的&LT; EventItem&GT;&GT; 部分它也能工作,但这种方式我不能使用LoaderManager

When I remove the implements LoaderCallbacks<ArrayList<EventItem>> part it works too, but this way I'm not able to use LoaderManager

为什么地球上的NoClassDefFoundError的错误,以及如何获得装载机在我MapCapableSherlockEnabledFragmentActivity工作?

推荐答案

您需要使用装载机从支持库,而不是从平台的人。因为那些只是在Android 3.0+并且您已经包括它们在你的类定义的事实将导致pre-3.0的类加载器来拒绝你的类顾左右而言他。切换你进口的支持库变量应该是所有需要为该。

You need to use the loaders from the support library rather than the ones from the platform. Since those are only available on Android 3.0+ and the fact that you've included them in your class definition will cause the pre-3.0 classloader to reject your class outright. Switching your imports to the support library variants should be all that's needed for that.

如果你看一下例外的logcat上面你会看到一个或多个VerifyErrors将勾勒出具体什么了问题。

If you look above the exception in Logcat you should see one or more VerifyErrors which will outline specifically what it took issue with.

您也可以只使用 Android的支持-V13 库在Android 3.2及以上(因此 V13 在其名称)。

You also can only use the android-support-v13 library on Android 3.2 and up (hence the v13 in its name).

这篇关于ActionBarSherlock +地图+装载机= java.lang.NoClassDefFoundError的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆