错误夸大类片段Android Map v2

错误夸大类片段Android Map v2,第1张

概述Iknowthisisaduplicatequestion,butsolutionsfrompreviouspostdoesn’tworkedforme.Thatswhyamaskingthisquestion.我正在尝试在AndroidApp中实现GoogleMapV2,但出现以下错误06-2619:24:51.035:E/AndroidRuntime(7679):FATALEXCEPTION:main

I kNow this is a duplicate question, but solutions from prevIoUs post doesn’t worked for
me. Thats why am asking this question.

我正在尝试在Android App中实现Google Map V2,但出现以下错误

06-26 19:24:51.035: E/AndroIDRuntime(7679): FATAL EXCEPTION: main06-26 19:24:51.035: E/AndroIDRuntime(7679): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.titutorial.mapdemo/com.titutorial.mapdemo.MainActivity}: androID.vIEw.InflateException: Binary XML file line #2: Error inflating class fragment06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2100)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.ActivityThread.access0(ActivityThread.java:140)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.os.Handler.dispatchMessage(Handler.java:99)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.os.Looper.loop(Looper.java:137)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.ActivityThread.main(ActivityThread.java:4898)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at java.lang.reflect.Method.invokeNative(Native Method)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at java.lang.reflect.Method.invoke(Method.java:511)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:773)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at dalvik.system.NativeStart.main(Native Method)06-26 19:24:51.035: E/AndroIDRuntime(7679): Caused by: androID.vIEw.InflateException: Binary XML file line #2: Error inflating class fragment06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:704)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:466)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:396)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.vIEw.LayoutInflater.inflate(LayoutInflater.java:352)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at com.androID.internal.policy.impl.PhoneWindow.setContentVIEw(PhoneWindow.java:308)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.Activity.setContentVIEw(Activity.java:1924)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at com.titutorial.mapdemo.MainActivity.onCreate(MainActivity.java:12)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.Activity.performCreate(Activity.java:5206)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1083)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:2064)06-26 19:24:51.035: E/AndroIDRuntime(7679):     ... 11 more06-26 19:24:51.035: E/AndroIDRuntime(7679): Caused by: androID.app.Fragment$InstantiationException: Unable to instantiate fragment com.Google.androID.gms.maps.MapFragment: make sure class name exists, is public, and has an empty constructor that is public06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.Fragment.instantiate(Fragment.java:584)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.Fragment.instantiate(Fragment.java:552)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.Activity.onCreateVIEw(Activity.java:4849)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.vIEw.LayoutInflater.createVIEwFromTag(LayoutInflater.java:680)06-26 19:24:51.035: E/AndroIDRuntime(7679):     ... 20 more06-26 19:24:51.035: E/AndroIDRuntime(7679): Caused by: java.lang.classNotFoundException: com.Google.androID.gms.maps.MapFragment06-26 19:24:51.035: E/AndroIDRuntime(7679):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at java.lang.classLoader.loadClass(ClassLoader.java:501)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at java.lang.classLoader.loadClass(ClassLoader.java:461)06-26 19:24:51.035: E/AndroIDRuntime(7679):     at androID.app.Fragment.instantiate(Fragment.java:574)06-26 19:24:51.035: E/AndroIDRuntime(7679):     ... 23 more

我遵循以下教程,

https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api

我做了下面的事情

>安装Google Play服务
>在Google控制台中创建了一个新应用,并获得了Google Map API密钥
>在eclipse中创建了新应用,并在AndroIDManifest.xml中添加了权限和Google Map API密钥
>在应用程序中添加了Google Play服务库
>将地图添加到应用程序(main.xml)
>设置目标API级别17

在我的main.xml中

<?xml version="1.0" enCoding="utf-8"?><fragment xmlns:androID="http://schemas.androID.com/apk/res/androID"          androID:ID="@+ID/map"          androID:layout_wIDth="match_parent"          androID:layout_height="match_parent"          androID:name="com.Google.androID.gms.maps.MapFragment"/>

这是我完整的源代码
https://github.com/railskarthi/MapDemo

解决方法:

在API 11之后,我认为您现在必须用SupportMapFragment替换MapFragment.就像这样:

<fragment xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:ID="@+ID/map" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:name="com.Google.androID.gms.maps.SupportMapFragment"/>

查看here以获取更多信息.让我知道你最近怎么样.

总结

以上是内存溢出为你收集整理的错误夸大类片段Android Map v2全部内容,希望文章能够帮你解决错误夸大类片段Android Map v2所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1093000.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存