2012-05-23 232 views
0

使用此示例Drawing a line/path on Google Maps我不斷收到來自LogCat的以下錯誤信息:它顯示無法找到類com.google.android.maps.Mapview - 我已導入com.google.android。 maps.MapView但不知道如何創建這個明顯的類 - 可有人請指教?謝謝Android - 繪製路徑

05-23 20:35:46.542: E/dalvikvm(408): Could not find class 'com.google.android.maps.MapView', referenced from method com.geomatrix.direction.MapdirectionActivity.onCreate 
05-23 20:35:46.542: W/dalvikvm(408): VFY: unable to resolve check-cast 342 (Lcom/google/android/maps/MapView;) in Lcom/geomatrix/direction/MapdirectionActivity; 
05-23 20:35:46.542: D/dalvikvm(408): VFY: replacing opcode 0x1f at 0x0016 
05-23 20:35:46.550: D/dalvikvm(408): VFY: dead code 0x0018-0182 in Lcom/geomatrix/direction/MapdirectionActivity;.onCreate (Landroid/os/Bundle;)V 
05-23 20:35:46.639: D/AndroidRuntime(408): Shutting down VM 
05-23 20:35:46.649: W/dalvikvm(408): threadid=1: thread exiting with uncaught exception (group=0x4001d800) 
05-23 20:35:46.679: E/AndroidRuntime(408): FATAL EXCEPTION: main 
05-23 20:35:46.679: E/AndroidRuntime(408): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.geomatrix.direction/com.geomatrix.direction.MapdirectionActivity}: android.view.InflateException: Binary XML file line #5: Error inflating class com.geomatrix.direction.MapView 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.os.Handler.dispatchMessage(Handler.java:99) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.os.Looper.loop(Looper.java:123) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.app.ActivityThread.main(ActivityThread.java:4627) 
05-23 20:35:46.679: E/AndroidRuntime(408): at java.lang.reflect.Method.invokeNative(Native Method) 
05-23 20:35:46.679: E/AndroidRuntime(408): at java.lang.reflect.Method.invoke(Method.java:521) 
05-23 20:35:46.679: E/AndroidRuntime(408): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 
05-23 20:35:46.679: E/AndroidRuntime(408): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 
05-23 20:35:46.679: E/AndroidRuntime(408): at dalvik.system.NativeStart.main(Native Method) 
05-23 20:35:46.679: E/AndroidRuntime(408): Caused by: android.view.InflateException: Binary XML file line #5: Error inflating class com.geomatrix.direction.MapView 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.view.LayoutInflater.inflate(LayoutInflater.java:407) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 
05-23 20:35:46.679: E/AndroidRuntime(408): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.app.Activity.setContentView(Activity.java:1647) 
05-23 20:35:46.679: E/AndroidRuntime(408): at com.geomatrix.direction.MapdirectionActivity.onCreate(MapdirectionActivity.java:30) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 
05-23 20:35:46.679: E/AndroidRuntime(408): ... 11 more 
05-23 20:35:46.679: E/AndroidRuntime(408): Caused by: java.lang.ClassNotFoundException: com.geomatrix.direction.MapView in loader dalvik.system.PathClassLoader[/data/app/com.geomatrix.direction-1.apk] 
05-23 20:35:46.679: E/AndroidRuntime(408): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 
05-23 20:35:46.679: E/AndroidRuntime(408): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 
05-23 20:35:46.679: E/AndroidRuntime(408): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.view.LayoutInflater.createView(LayoutInflater.java:466) 
05-23 20:35:46.679: E/AndroidRuntime(408): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565) 
05-23 20:35:46.679: E/AndroidRuntime(408): ... 20 more 

有人可以請幫忙;即時通訊

回答

0

您是否在清單中包含下一行?

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

,並把它在正確的地方(開放應用標籤後),例如:

<application 
    android:hardwareAccelerated="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 
    <uses-library 
     android:name="com.google.android.maps" 
     android:required="true" /> 

    <activity ... 
1

我有同樣的問題,我發現我失蹤了「谷歌」參考在我的XML標籤。我最初有它像「com.android.maps.MapView」這是顯而易見的錯誤。 它應該像下面的東西

<com.google.android.maps.MapView 
    android:id="@+id/map" 
    android:apiKey="mapAPIkey" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:clickable="true" 
/>