2013-05-16 190 views
7

我正在使用谷歌地圖api v2和一切工作正常。今天早上我更新了SDK,現在地圖不工作。嘗試了很多事情,例如再次導入lib項目,但似乎沒有任何工作。 Plz的幫助。谷歌地圖api v2類未找到

這是logcat的輸出

05-16 08:53:34.327: E/dalvikvm(3422): Could not find class 'com.google.android.gms.maps.model.LatLng', referenced from method com.apptree.de_luxe.InfoActivity.<clinit> 
05-16 08:53:34.327: W/dalvikvm(3422): VFY: unable to resolve new-instance 170 (Lcom/google/android/gms/maps/model/LatLng;) in Lcom/apptree/de_luxe/InfoActivity; 
05-16 08:53:34.327: D/dalvikvm(3422): VFY: replacing opcode 0x22 at 0x0000 
05-16 08:53:34.327: E/dalvikvm(3422): Could not find class 'com.google.android.gms.maps.model.MarkerOptions', referenced from method com.apptree.de_luxe.InfoActivity.setUpMap 
05-16 08:53:34.327: W/dalvikvm(3422): VFY: unable to resolve new-instance 172 (Lcom/google/android/gms/maps/model/MarkerOptions;) in Lcom/apptree/de_luxe/InfoActivity; 
05-16 08:53:34.327: D/dalvikvm(3422): VFY: replacing opcode 0x22 at 0x0002 
05-16 08:53:34.347: E/dalvikvm(3422): Could not find class 'com.google.android.gms.maps.MapFragment', referenced from method com.apptree.de_luxe.InfoActivity.setUpMapIfNeeded 
05-16 08:53:34.347: W/dalvikvm(3422): VFY: unable to resolve check-cast 169 (Lcom/google/android/gms/maps/MapFragment;) in Lcom/apptree/de_luxe/InfoActivity; 
05-16 08:53:34.357: D/dalvikvm(3422): VFY: replacing opcode 0x1f at 0x000f 
05-16 08:53:34.367: D/dalvikvm(3422): DexOpt: unable to opt direct call 0x029b at 0x0c in Lcom/apptree/de_luxe/InfoActivity;.<clinit> 
05-16 08:53:34.367: D/dalvikvm(3422): DexOpt: unable to opt direct call 0x029c at 0x04 in Lcom/apptree/de_luxe/InfoActivity;.setUpMap 
05-16 08:53:34.387: W/dalvikvm(3422): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/apptree/de_luxe/InfoActivity; 
05-16 08:53:34.387: W/dalvikvm(3422): Class init failed in newInstance call (Lcom/apptree/de_luxe/InfoActivity;) 
05-16 08:53:34.387: D/AndroidRuntime(3422): Shutting down VM 
05-16 08:53:34.398: W/dalvikvm(3422): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 
05-16 08:53:34.457: E/AndroidRuntime(3422): FATAL EXCEPTION: main 
05-16 08:53:34.457: E/AndroidRuntime(3422): java.lang.ExceptionInInitializerError 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at java.lang.Class.newInstanceImpl(Native Method) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at java.lang.Class.newInstance(Class.java:1319) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at android.app.ActivityThread.access$600(ActivityThread.java:141) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at android.os.Handler.dispatchMessage(Handler.java:99) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at android.os.Looper.loop(Looper.java:137) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at android.app.ActivityThread.main(ActivityThread.java:5041) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at java.lang.reflect.Method.invokeNative(Native Method) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at java.lang.reflect.Method.invoke(Method.java:511) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at dalvik.system.NativeStart.main(Native Method) 
05-16 08:53:34.457: E/AndroidRuntime(3422): Caused by: java.lang.NoClassDefFoundError: com.google.android.gms.maps.model.LatLng 
05-16 08:53:34.457: E/AndroidRuntime(3422):  at com.apptree.de_luxe.InfoActivity.<clinit>(InfoActivity.java:35) 
05-16 08:53:34.457: E/AndroidRuntime(3422):  ... 15 more 
+0

你有沒有引用你的android地圖項目中的谷歌播放服務庫? – Raghunandan

+0

@Ravi Raghunandan是對的......你應該正確地將google-play-serives_lib引用到你的項目中。 – TheFlash

+0

已經做到了。在Android下的屬性我已經添加了lib項目,我的目標是谷歌api – Ravi

回答

22

在Eclipse中去:

「項目」 - > 「屬性」 - > 「Java構建屬性」

在「排序和導出「選項卡我檢查了我的項目上的」Android私有庫「。我也爲它參考的圖書館項目做了這個。這固定了我的班級在升級到SDK 22後未發現錯誤。

+0

上創建了一個密鑰,終於有些工作感謝的人。 – Ravi

+0

是的,它的工作 –

+0

+ 1我剛剛遇到同樣的問題後更新和解決它。 – Raghunandan

4

您應該在地圖項目中引用google play服務庫項目。

將您的圖庫項目導入您的工作區。導入相同的日食。

右鍵單擊您的項目。轉到屬性。選擇android。點擊android。瀏覽並添加庫項目。

enter image description here

+0

做了沒有工作 – Ravi

+0

你在導入新的lib之前是否從當前工作區中刪除了舊的? –

+0

@Ravi你可以發佈一些更多的細節清單文件和代碼。 – Raghunandan