ClassNotFound的launchig地图活动的Andr​​oid库中声明 [英] ClassNotFound launchig maps activity declared in Android library

查看:133
本文介绍了ClassNotFound的launchig地图活动的Andr​​oid库中声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试图启动一个从MapActivity衍生活动(TestLocationActivity),当这个例外,并且这是一个Android库项目中声明:

 九月9日至8日:29:45.357:ERROR / AndroidRuntime(7502):java.lang.NoClassDefFoundError的:msumo.business.testlocation.impl.view.TestLocationActivity
9月9日至八日:29:45.357:ERROR / AndroidRuntime(7502):在msumo.app.test2.impl.Test2AppManagerImpl.loadNewScreen(Test2AppManagerImpl.java:94)
9月9日至八日:29:45.357:ERROR / AndroidRuntime(7502):在msumo.business.common.GuiAppManager.handleMessage(GuiAppManager.java:101)
9月9日至八日:29:45.357:ERROR / AndroidRuntime(7502):在msumo.core.MessageBus.dispatchMessage(MessageBus.java:338)
9月9日至八日:29:45.357:ERROR / AndroidRuntime(7502):在msumo.core.MessageBus $ 1.doWork(MessageBus.java:251)
9月9日至八日:29:45.357:ERROR / AndroidRuntime(7502):在msumo.core.util.WorkerThread.run(WorkerThread.java:29)

我无法找到问题的根源。我已经包含在主应用程序和库项目中的谷歌地图图书馆宣言都AndroidManifest.xml中:

 <使用库机器人:名字=com.google.android.maps/>

在Eclipse中我没有得到任何错误,应用程序通常会启动,但尝试启动失败指示的活动时。 code的启动活动的chunck是下列之一:

 意向意图=新意图(CTX,TestLocationActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ctx.startActivity(意向);

我没有什么可以是错误的线索。难道也许无法从Android库项目中使用谷歌的API库?

更新


我发现了一些痕迹系统,可以帮助清除情况:

  10月9日至8日:53:34.615:信息/ dalvikvm(13221):拒绝对previously-未能类Lmsumo /平台/位置重新初始化/ IMPL / LocationModuleImpl $ 2 ; V =为0x0
10月9日至8日:53:34.654:WARN / System.err的(13221):java.lang.NoClassDefFoundError的:msumo.platform.location.impl.LocationModuleImpl $ 2
10月9日至8日:53:34.654:WARN / System.err的(13221):在msumo.platform.location.impl.LocationModuleImpl.doUseBestProvider(LocationModuleImpl.java:189)
10月9日至8日:53:34.654:WARN / System.err的(13221):在msumo.platform.location.LocationModule.performQuery(LocationModule.java:329)
10月9日至8日:53:34.662:WARN / System.err的(13221):在msumo.platform.location.LocationModule.handleMessage(LocationModule.java:543)
10月9日至8日:53:34.662:WARN / System.err的(13221):在msumo.core.MessageBus.dispatchMessage(MessageBus.java:338)
10月9日至8日:53:34.662:WARN / System.err的(13221):在msumo.core.MessageBus $ 1.doWork(MessageBus.java:251)
10月9日至8日:53:34.669:WARN / System.err的(13221):在msumo.core.util.WorkerThread.run(WorkerThread.java:29)
10月9日至8日:53:34.685:WARN / System.err的(13221):java.lang.NoClassDefFoundError的:msumo.platform.location.impl.LocationModuleImpl $ 2
10月9日至8日:53:34.685:WARN / System.err的(13221):在msumo.platform.location.impl.LocationModuleImpl.doUseBestProvider(LocationModuleImpl.java:189)
10月9日至8日:53:34.685:WARN / System.err的(13221):在msumo.platform.location.LocationModule.performQuery(LocationModule.java:329)
10月9日至8日:53:34.693:WARN / System.err的(13221):在msumo.platform.location.LocationModule.handleMessage(LocationModule.java:543)
10月9日至8日:53:34.693:WARN / System.err的(13221):在msumo.core.MessageBus.dispatchMessage(MessageBus.java:338)
10月9日至8日:53:34.693:WARN / System.err的(13221):在msumo.core.MessageBus $ 1.doWork(MessageBus.java:251)
10月9日至8日:53:34.693:WARN / System.err的(13221):在msumo.core.util.WorkerThread.run(WorkerThread.java:29)


解决方案

如果你想使用谷歌提供你需要完成3个步骤的MapView:


  1. 获取为您调试API密钥和证书,部署和使用您的应用程序内正确的

  2. 使用自带的谷歌API的模拟器或设备。在建立一个AVD,你可以选择是否在设备应使用或不使用谷歌库。

  3. 注册谷歌地图图书馆的使用在你的清单。这是通过添加完成:搜索
    <使用库机器人:名字=com.google.android.maps/> 结果
    你的清单中的应用标签。确保用途库是应用程序标签内不仅在你的清单

I am getting this exception when trying to start an activity (TestLocationActivity) that is derived from MapActivity, and which is declared inside an Android library project:

09-08 09:29:45.357: ERROR/AndroidRuntime(7502): java.lang.NoClassDefFoundError: msumo.business.testlocation.impl.view.TestLocationActivity
09-08 09:29:45.357: ERROR/AndroidRuntime(7502):     at msumo.app.test2.impl.Test2AppManagerImpl.loadNewScreen(Test2AppManagerImpl.java:94)
09-08 09:29:45.357: ERROR/AndroidRuntime(7502):     at msumo.business.common.GuiAppManager.handleMessage(GuiAppManager.java:101)
09-08 09:29:45.357: ERROR/AndroidRuntime(7502):     at msumo.core.MessageBus.dispatchMessage(MessageBus.java:338)
09-08 09:29:45.357: ERROR/AndroidRuntime(7502):     at msumo.core.MessageBus$1.doWork(MessageBus.java:251)
09-08 09:29:45.357: ERROR/AndroidRuntime(7502):     at msumo.core.util.WorkerThread.run(WorkerThread.java:29)

I can not find the source of the problem. I have included in both AndroidManifest.xml of main application and library project the Google Maps library declaration:

 <uses-library android:name="com.google.android.maps" />

In Eclipse I get no error and application launches normally, but when trying to start the indicated Activity it fails. The chunck of code that starts the activity is the following one:

    Intent intent = new Intent(ctx, TestLocationActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    ctx.startActivity(intent);

I have no clue about what can be wrong. Is it maybe impossible to use a Google APIs library from an Android Library project?

Update


I found some System traces that could help clear the situation:

09-08 10:53:34.615: INFO/dalvikvm(13221): Rejecting re-init on previously-failed class Lmsumo/platform/location/impl/LocationModuleImpl$2; v=0x0
09-08 10:53:34.654: WARN/System.err(13221): java.lang.NoClassDefFoundError: msumo.platform.location.impl.LocationModuleImpl$2
09-08 10:53:34.654: WARN/System.err(13221):     at msumo.platform.location.impl.LocationModuleImpl.doUseBestProvider(LocationModuleImpl.java:189)
09-08 10:53:34.654: WARN/System.err(13221):     at msumo.platform.location.LocationModule.performQuery(LocationModule.java:329)
09-08 10:53:34.662: WARN/System.err(13221):     at msumo.platform.location.LocationModule.handleMessage(LocationModule.java:543)
09-08 10:53:34.662: WARN/System.err(13221):     at msumo.core.MessageBus.dispatchMessage(MessageBus.java:338)
09-08 10:53:34.662: WARN/System.err(13221):     at msumo.core.MessageBus$1.doWork(MessageBus.java:251)
09-08 10:53:34.669: WARN/System.err(13221):     at msumo.core.util.WorkerThread.run(WorkerThread.java:29)
09-08 10:53:34.685: WARN/System.err(13221): java.lang.NoClassDefFoundError: msumo.platform.location.impl.LocationModuleImpl$2
09-08 10:53:34.685: WARN/System.err(13221):     at msumo.platform.location.impl.LocationModuleImpl.doUseBestProvider(LocationModuleImpl.java:189)
09-08 10:53:34.685: WARN/System.err(13221):     at msumo.platform.location.LocationModule.performQuery(LocationModule.java:329)
09-08 10:53:34.693: WARN/System.err(13221):     at msumo.platform.location.LocationModule.handleMessage(LocationModule.java:543)
09-08 10:53:34.693: WARN/System.err(13221):     at msumo.core.MessageBus.dispatchMessage(MessageBus.java:338)
09-08 10:53:34.693: WARN/System.err(13221):     at msumo.core.MessageBus$1.doWork(MessageBus.java:251)
09-08 10:53:34.693: WARN/System.err(13221):     at msumo.core.util.WorkerThread.run(WorkerThread.java:29)

解决方案

If you want to use the MapView provided by google you need to complete 3 steps:

  1. Obtain an Api Key for your debug and deploy certificate and use the right one inside your app
  2. Use an Emulator or Device that comes with the Google API. During creation of an AVD you can choose if the device should be with or without the Google Libraries.
  3. Register the usage of the Google Maps Library in your Manifest. This is done through adding:
    <uses-library android:name="com.google.android.maps" />
    to the application tag of your manifest. Be sure that the uses library is inside the application tag and not only in your manifest

这篇关于ClassNotFound的launchig地图活动的Andr​​oid库中声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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