2013-02-11 221 views
0

我一直在試圖實施一個示例應用程序,以研究谷歌地圖API的工作。我已經對配置本身感到震驚。我似乎無法運行該應用程序。谷歌地圖問題Android Api v2

這裏是我的代碼在Github上: -

https://github.com/siva54/SampleMapApplication

而且這裏是我的logcat: -

02-11 15:09:07.492: I/Process(10080): Sending signal. PID: 10080 SIG: 9 
02-11 15:09:17.012: E/dalvikvm(10364): Could not find class 'com.google.android.gms.maps.model.MarkerOptions', referenced from method  com.myapp.gasapplication.MainActivity.setUpMap 
02-11 15:09:17.012: W/dalvikvm(10364): VFY: unable to resolve new-instance 455 (Lcom/google/android/gms/maps/model/MarkerOptions;) in Lcom/myapp/gasapplication/MainActivity; 
02-11 15:09:17.012: D/dalvikvm(10364): VFY: replacing opcode 0x22 at 0x0004 
02-11 15:09:17.012: E/dalvikvm(10364): Could not find class 'com.google.android.gms.maps.SupportMapFragment', referenced from method com.myapp.gasapplication.MainActivity.setUpMapIfNeeded 
02-11 15:09:17.012: W/dalvikvm(10364): VFY: unable to resolve check-cast 452 (Lcom/google/android/gms/maps/SupportMapFragment;) in Lcom/myapp/gasapplication/MainActivity; 
02-11 15:09:17.012: D/dalvikvm(10364): VFY: replacing opcode 0x1f at 0x000e 
02-11 15:09:17.012: D/dalvikvm(10364): DexOpt: unable to opt direct call 0x0cd0 at 0x06 in Lcom/myapp/gasapplication/MainActivity;.setUpMap 
02-11 15:09:17.022: D/dalvikvm(10364): DexOpt: unable to opt direct call 0x0ccf at 0x0b in Lcom/myapp/gasapplication/MainActivity;.setUpMap 
02-11 15:09:17.072: D/AndroidRuntime(10364): Shutting down VM 
02-11 15:09:17.072: W/dalvikvm(10364): threadid=1: thread exiting with uncaught exception (group=0x40e02930) 
02-11 15:09:17.082: E/AndroidRuntime(10364): FATAL EXCEPTION: main 
02-11 15:09:17.082: E/AndroidRuntime(10364): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.gasapplication/com.myapp.gasapplication.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.app.ActivityThread.access$600(ActivityThread.java:141) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.os.Handler.dispatchMessage(Handler.java:99) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.os.Looper.loop(Looper.java:137) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.app.ActivityThread.main(ActivityThread.java:5039) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at java.lang.reflect.Method.invokeNative(Native Method) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at java.lang.reflect.Method.invoke(Method.java:511) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at dalvik.system.NativeStart.main(Native Method) 
02-11 15:09:17.082: E/AndroidRuntime(10364): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.app.Activity.setContentView(Activity.java:1881) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at com.myapp.gasapplication.MainActivity.onCreate(MainActivity.java:25) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.app.Activity.performCreate(Activity.java:5104) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 
02-11 15:09:17.082: E/AndroidRuntime(10364): ... 11 more 
02-11 15:09:17.082: E/AndroidRuntime(10364): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.support.v4.app.Fragment.instantiate(Fragment.java:401) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.support.v4.app.Fragment.instantiate(Fragment.java:369) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676) 
02-11 15:09:17.082: E/AndroidRuntime(10364): ... 21 more 
02-11 15:09:17.082: E/AndroidRuntime(10364): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.SupportMapFragment" on path: /data/app/com.myapp.gasapplication-1.apk 
02-11 15:09:17.082: E/AndroidRuntime(10364): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 
02-11 15:09:17.082: E/AndroidRuntime(10364): at android.support.v4.app.Fragment.instantiate(Fragment.java:391) 
02-11 15:09:17.082: E/AndroidRuntime(10364): ... 24 more 
02-11 15:10:58.032: E/dalvikvm(10887): Could not find class 'com.google.android.gms.maps.model.MarkerOptions', referenced from method com.myapp.gasapplication.MainActivity.setUpMap 
02-11 15:10:58.032: W/dalvikvm(10887): VFY: unable to resolve new-instance 455 (Lcom/google/android/gms/maps/model/MarkerOptions;) in Lcom/myapp/gasapplication/MainActivity; 
02-11 15:10:58.032: D/dalvikvm(10887): VFY: replacing opcode 0x22 at 0x0004 
02-11 15:10:58.032: E/dalvikvm(10887): Could not find class 'com.google.android.gms.maps.SupportMapFragment', referenced from method com.myapp.gasapplication.MainActivity.setUpMapIfNeeded 
02-11 15:10:58.032: W/dalvikvm(10887): VFY: unable to resolve check-cast 452 (Lcom/google/android/gms/maps/SupportMapFragment;) in Lcom/myapp/gasapplication/MainActivity; 
02-11 15:10:58.032: D/dalvikvm(10887): VFY: replacing opcode 0x1f at 0x000e 
02-11 15:10:58.032: D/dalvikvm(10887): DexOpt: unable to opt direct call 0x0cd0 at 0x06 in Lcom/myapp/gasapplication/MainActivity;.setUpMap 
02-11 15:10:58.032: D/dalvikvm(10887): DexOpt: unable to opt direct call 0x0ccf at 0x0b in Lcom/myapp/gasapplication/MainActivity;.setUpMap 
02-11 15:10:58.092: D/AndroidRuntime(10887): Shutting down VM 
02-11 15:10:58.092: W/dalvikvm(10887): threadid=1: thread exiting with uncaught exception (group=0x40e02930) 
02-11 15:10:58.092: E/AndroidRuntime(10887): FATAL EXCEPTION: main 
02-11 15:10:58.092: E/AndroidRuntime(10887): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.gasapplication/com.myapp.gasapplication.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.app.ActivityThread.access$600(ActivityThread.java:141) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.os.Handler.dispatchMessage(Handler.java:99) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.os.Looper.loop(Looper.java:137) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.app.ActivityThread.main(ActivityThread.java:5039) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at java.lang.reflect.Method.invokeNative(Native Method) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at java.lang.reflect.Method.invoke(Method.java:511) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at dalvik.system.NativeStart.main(Native Method) 
02-11 15:10:58.092: E/AndroidRuntime(10887): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.view.LayoutInflater.inflate(LayoutInflater.java:352) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.app.Activity.setContentView(Activity.java:1881) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at com.myapp.gasapplication.MainActivity.onCreate(MainActivity.java:25) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.app.Activity.performCreate(Activity.java:5104) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 
02-11 15:10:58.092: E/AndroidRuntime(10887): ... 11 more 
02-11 15:10:58.092: E/AndroidRuntime(10887): Caused by: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.SupportMapFragment: make sure class name exists, is public, and has an empty constructor that is public 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.support.v4.app.Fragment.instantiate(Fragment.java:401) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.support.v4.app.Fragment.instantiate(Fragment.java:369) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676) 
02-11 15:10:58.092: E/AndroidRuntime(10887): ... 21 more 
02-11 15:10:58.092: E/AndroidRuntime(10887): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.SupportMapFragment" on path: /data/app/com.myapp.gasapplication-2.apk 
02-11 15:10:58.092: E/AndroidRuntime(10887): at  dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 
02-11 15:10:58.092: E/AndroidRuntime(10887): at android.support.v4.app.Fragment.instantiate(Fragment.java:391) 
02-11 15:10:58.092: E/AndroidRuntime(10887): ... 24 more 

請你幫忙嗎?提前致謝。

+0

你創建與谷歌的項目,而不是??的android – Ajouve 2013-02-12 13:40:33

+0

我用android創建了我的項目。在開發過程中,我使用Android和Android + Google apks執行了它。 – daemon54 2013-02-12 16:56:39

回答

0

看起來它沒有在運行時找到Google Maps類。您是否在設備或模擬器上運行此功能,因爲目前您無法在模擬器上使用Google Maps v2。

如果您正在設備上運行,請確保您已安裝Google Play服務。它包含Google Maps v2的運行時。

+0

嘿達米安。我在我的nexus 7上運行它。我剛剛檢查了play.google,它報告已安裝谷歌播放服務。 – daemon54 2013-02-12 16:55:33