Android上的谷歌地图API不工作 [英] Google Maps API on android not working
问题描述
我想添加地图到Android应用程序。结果
但我得到下面的错误公布。
我已经安装了谷歌播放服务,并还增加结果
我的应用程序所需的依赖,支持地图。
我添加所需的API密钥的清单,结果
添加了以下线的应用标记之后。
使用库机器人:要求=真结果
机器人:名字=com.google.android.gms
块引用>结果,(在应用程序代码中的一个元素,而不是一个属性以下)
一个想法是什么,我做错了?15 03-12:31:11.457:E / AndroidRuntime(12833):致命异常:主要
03-12 15:31:11.457:E / AndroidRuntime(12833):java.lang.ExceptionInInitializerError
03-12 15:31:11.457:E / AndroidRuntime(12833):在java.lang.Class.newInstanceImpl(本机方法)
03-12 15:31:11.457:E / AndroidRuntime(12833):在java.lang.Class.newInstance(Class.java:1319)
03-12 15:31:11.457:E / AndroidRuntime(12833):在android.app.Instrumentation.newActivity(Instrumentation.java:1054)
03-12 15:31:11.457:E / AndroidRuntime(12833):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
03-12 15:31:11.457:E / AndroidRuntime(12833):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-12 15:31:11.457:E / AndroidRuntime(12833):在android.app.ActivityThread.access $ 600(ActivityThread.java:141)
03-12 15:31:11.457:E / AndroidRuntime(12833):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1234)
03-12 15:31:11.457:E / AndroidRuntime(12833):在android.os.Handler.dispatchMessage(Handler.java:99)
03-12 15:31:11.457:E / AndroidRuntime(12833):在android.os.Looper.loop(Looper.java:137)
03-12 15:31:11.457:E / AndroidRuntime(12833):在android.app.ActivityThread.main(ActivityThread.java:5041)
03-12 15:31:11.457:E / AndroidRuntime(12833):在java.lang.reflect.Method.invokeNative(本机方法)
03-12 15:31:11.457:E / AndroidRuntime(12833):在java.lang.reflect.Method.invoke(Method.java:511)
03-12 15:31:11.457:E / AndroidRuntime(12833):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:793)
03-12 15:31:11.457:E / AndroidRuntime(12833):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-12 15:31:11.457:E / AndroidRuntime(12833):在dalvik.system.NativeStart.main(本机方法)
03-12 15:31:11.457:E / AndroidRuntime(12833):java.lang.NoClassDefFoundError的:产生的原因com.google.android.gms.maps.model.LatLng
解决方案所以我前几天破获这个问题,这是我如何做它的工作。我删除了谷歌发挥图书馆的所有痕迹在项目部分。接下来,我重新导入谷歌的游戏库,但这个时候,我点击选项复制到我的工作区也是如此。接下来,在添加了这个库的编译路径和它的工作。
I am trying to add a map to my android application.
But I am getting the error posted below.I have installed the google play services, and have also added
the required dependency for my app to support map.I have added the required api key to the manifest,
added the following line after the application taguses-library android:required="true"
android:name="com.google.android.gms"(the following in an element of the application tag and not an attribute)
An idea what I am doing wrong?03-12 15:31:11.457: E/AndroidRuntime(12833): FATAL EXCEPTION: main 03-12 15:31:11.457: E/AndroidRuntime(12833): java.lang.ExceptionInInitializerError 03-12 15:31:11.457: E/AndroidRuntime(12833): at java.lang.Class.newInstanceImpl(Native Method) 03-12 15:31:11.457: E/AndroidRuntime(12833): at java.lang.Class.newInstance(Class.java:1319) 03-12 15:31:11.457: E/AndroidRuntime(12833): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 03-12 15:31:11.457: E/AndroidRuntime(12833): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) 03-12 15:31:11.457: E/AndroidRuntime(12833): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 03-12 15:31:11.457: E/AndroidRuntime(12833): at android.app.ActivityThread.access$600(ActivityThread.java:141) 03-12 15:31:11.457: E/AndroidRuntime(12833): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 03-12 15:31:11.457: E/AndroidRuntime(12833): at android.os.Handler.dispatchMessage(Handler.java:99) 03-12 15:31:11.457: E/AndroidRuntime(12833): at android.os.Looper.loop(Looper.java:137) 03-12 15:31:11.457: E/AndroidRuntime(12833): at android.app.ActivityThread.main(ActivityThread.java:5041) 03-12 15:31:11.457: E/AndroidRuntime(12833): at java.lang.reflect.Method.invokeNative(Native Method) 03-12 15:31:11.457: E/AndroidRuntime(12833): at java.lang.reflect.Method.invoke(Method.java:511) 03-12 15:31:11.457: E/AndroidRuntime(12833): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 03-12 15:31:11.457: E/AndroidRuntime(12833): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 03-12 15:31:11.457: E/AndroidRuntime(12833): at dalvik.system.NativeStart.main(Native Method) 03-12 15:31:11.457: E/AndroidRuntime(12833): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.maps.model.LatLng
解决方案so I cracked this question a few days ago and here is how I made it work. I removed all traces of the google play library in the projects sections. Next I re-imported the google play library but this time I clicked the option for copying it into my workspace as well. Next in the added this library in the compile paths and it worked.
这篇关于Android上的谷歌地图API不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!