我正在尝试使用 Google Maps Android API v2 创建 Google Map 应用程序。我已经安装了 Google Play 服务和 Google Maps Mobile SDK for Business。当我在main.xml中添加代码并运行程序时,它会提示错误。
main.xml 中的代码
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.m4b.maps.MapFragment"/>
错误信息:
10-23 15:59:16.131: W/dalvikvm(7769): VFY: unable to resolve static field 3723 (MapM4bAttrs) in Lcom/google/android/m4b/maps/R$styleable;
10-23 15:59:16.131: D/dalvikvm(7769): VFY: replacing opcode 0x62 at 0x000e
10-23 15:59:16.131: D/AndroidRuntime(7769): Shutting down VM
10-23 15:59:16.131: W/dalvikvm(7769): threadid=1: thread exiting with uncaught exception (group=0x4170b700)
10-23 15:59:16.131: E/AndroidRuntime(7769): FATAL EXCEPTION: main
10-23 15:59:16.131: E/AndroidRuntime(7769): java.lang.NoClassDefFoundError:com.google.android.m4b.maps.R$styleable
10-23 15:59:16.131: E/AndroidRuntime(7769): at com.google.android.m4b.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
10-23 15:59:16.131: E/AndroidRuntime(7769): at com.google.android.m4b.maps.MapFragment.onInflate(Unknown Source)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.app.Activity.onCreateView(Activity.java:4745)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
10-23 15:59:16.131: E/AndroidRuntime(7769): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.app.Activity.setContentView(Activity.java:1895)
10-23 15:59:16.131: E/AndroidRuntime(7769): at com.example.googlemap.MainActivity.onCreate(MainActivity.java:12)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.app.Activity.performCreate(Activity.java:5133)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.os.Handler.dispatchMessage(Handler.java:99)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.os.Looper.loop(Looper.java:137)
10-23 15:59:16.131: E/AndroidRuntime(7769): at android.app.ActivityThread.main(ActivityThread.java:5103)
10-23 15:59:16.131: E/AndroidRuntime(7769): at java.lang.reflect.Method.invokeNative(Native Method)
10-23 15:59:16.131: E/AndroidRuntime(7769): at java.lang.reflect.Method.invoke(Method.java:525)
10-23 15:59:16.131: E/AndroidRuntime(7769): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-23 15:59:16.131: E/AndroidRuntime(7769): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-23 15:59:16.131: E/AndroidRuntime(7769): at dalvik.system.NativeStart.main(Native Method)
10-23 15:59:17.472: I/Process(7769): Sending signal. PID: 7769 SIG: 9