Google Map:我无法使用MapView

时间:2012-06-12 16:07:34

标签: android google-maps android-mapview

由于某些原因,这对xml是不可见的,并且应用程序崩溃了。 我该怎么做才能解决它?

的manifest.xml

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/map_holder"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent">

   <com.google.android.maps.MapView -----> do not recognize this
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/map"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:apiKey="my_key"
   />
</LinearLayout>

这是我得到的例外!

  

致命的例外:主要

java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
at dalvik.system.DexFile.defineClass(Native Method)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:207)
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:200)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3691)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)

我该如何解决?

2 个答案:

答案 0 :(得分:0)

正确使用的课程是:

com.google.android.maps.MapView

答案 1 :(得分:0)

您是否在<uses-library android:name="com.google.android.maps"/>文件中添加了AndroidManifest,并使用 Google API Android SDK 来构建项目,并在AndroidManifest中添加<uses-permission android:name="android.permission.INTERNET"/>以获取互联网权限