谷歌地图Android的API V2而崩溃NoClassDefFound错误 [英] Google Maps Android API v2 crashes with NoClassDefFound Error

查看:110
本文介绍了谷歌地图Android的API V2而崩溃NoClassDefFound错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现的最基本的例子谷歌地图Android的API V2的例子。 但它与错误崩溃:java.lang.NoClassDefFoundError的:com.google.android.gms.R $设置样式

我已经设置了谷歌的API,并看着计算器岗位,如:

但他们的问题比我的略有不同。

您可以请点我朝着正确的方向?我使用了Android 2.2,并想使用新的地图,以充分利用在我的应用程序的片段;这样我就可以得到像苹果的uinavigation一些功能推新观点在弹出的活动。

感谢。

感谢你,你是怎么得到你是显示在附件巴布亚新几内亚的谷歌播放服务显示为我的包资源管理器中引用的库?;我没有添加它;这是我的logcat:

  6月一号至16日:23:55.087:E / AndroidRuntime(305):致命异常:主要
六月一号至16日:23:55.087:E / AndroidRuntime(305):java.lang.NoClassDefFoundError的:com.google.android.gms.R $设置样式
六月一号至16日:23:55.087:E / AndroidRuntime(305):在com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(来源不明)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在com.google.android.gms.maps.SupportMapFragment.onInflate(来源不明)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:271)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.view.LayoutInflater.inflate(LayoutInflater.java:407)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.view.LayoutInflater.inflate(LayoutInflater.java:320)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.view.LayoutInflater.inflate(LayoutInflater.java:276)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.app.Activity.setContentView(Activity.java:1647)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在com.example.afis.MainActivity.onCreate(MainActivity.java:13)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.app.ActivityThread.access $ 2300(ActivityThread.java:125)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:2033)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.os.Handler.dispatchMessage(Handler.java:99)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.os.Looper.loop(Looper.java:123)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在android.app.ActivityThread.main(ActivityThread.java:4627)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在java.lang.reflect.Method.invokeNative(本机方法)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在java.lang.reflect.Method.invoke(Method.java:521)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
六月一号至16日:23:55.087:E / AndroidRuntime(305):在dalvik.system.NativeStart.main(本机方法)
六月一号至16日:23:55.097:W / ActivityManager(59):强制完成活动com.example.afis / .MainActivity
六月一号至16日:23:55.607:W / ActivityManager(59):活动暂停超时HistoryRecord {44ee9110 com.example.afis / .MainActivity}
 

解决方案

我通过检查项目复制到工作区,同时导入谷歌播放服务的lib解决了这个错误。 更多资讯: http://developer.android.com/google/play-services /setup.html

I am trying to implement the most basic example of google maps android api v2 example. But it crashes with the error:java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable.

I have set up the google api and have looked at stackoverflow posts like:

but their problems are slightly different than mine.

Can you please point me to the right direction? I am using android 2.2 and would like to use the new Maps to make use of fragments in my app; so that I can get some functionality like apple's uinavigation to push new views in a pop up activity.

Thanks.

Thank you,how did you get to the png you are showing in the attachment?The google play service is shown as a referenced library in my package explorer; I did add it; this is my logcat:

01-16 06:23:55.087: E/AndroidRuntime(305): FATAL EXCEPTION: main
01-16 06:23:55.087: E/AndroidRuntime(305): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
01-16 06:23:55.087: E/AndroidRuntime(305):  at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
01-16 06:23:55.087: E/AndroidRuntime(305):  at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:271)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-16 06:23:55.087: E/AndroidRuntime(305):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.app.Activity.setContentView(Activity.java:1647)
01-16 06:23:55.087: E/AndroidRuntime(305):  at com.example.afis.MainActivity.onCreate(MainActivity.java:13)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.os.Looper.loop(Looper.java:123)
01-16 06:23:55.087: E/AndroidRuntime(305):  at android.app.ActivityThread.main(ActivityThread.java:4627)
01-16 06:23:55.087: E/AndroidRuntime(305):  at java.lang.reflect.Method.invokeNative(Native Method)
01-16 06:23:55.087: E/AndroidRuntime(305):  at java.lang.reflect.Method.invoke(Method.java:521)
01-16 06:23:55.087: E/AndroidRuntime(305):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-16 06:23:55.087: E/AndroidRuntime(305):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-16 06:23:55.087: E/AndroidRuntime(305):  at dalvik.system.NativeStart.main(Native Method)
01-16 06:23:55.097: W/ActivityManager(59):   Force finishing activity com.example.afis/.MainActivity
01-16 06:23:55.607: W/ActivityManager(59): Activity pause timeout for HistoryRecord{44ee9110 com.example.afis/.MainActivity}

解决方案

I solved this error by checking "Copy projects into workspace" while importing the Google Play Services lib. More info here: http://developer.android.com/google/play-services/setup.html

这篇关于谷歌地图Android的API V2而崩溃NoClassDefFound错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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