这是我的问题:
我一直在做这个教程: http ://www.androidhive.info/2013/08/android-working-with-google-maps-v2/ (还有更多,但每一个都给我错误)
我已经完成了它需要做的一切(权限、库、API 代码)。API代码正确完成!
以下是一些截图:-activity_main.xml [1] http://i.imgur.com/MwLwMtu.jpg
- AndroidManifest.xml [1] http://i.imgur.com/Esyqfuo.jpg [2] http://i.imgur.com/VzwZLnm.jpg
错误:
11-07 20:02:28.969: E/Godfrey5(5234): BitmapFactory.java, decodeStream()
11-07 20:02:28.969: E/BitmapFactory(5234): Godfrey5==BitmapFactory.cpp, nativeDecodeAsset()
11-07 20:02:28.969: E/BitmapFactory(5234): Godfrey5==BitmapFactory.cpp, doDecode()
11-07 20:02:28.969: E/BitmapFactory(5234): Godfrey5==BitmapFactory.cpp, doDecode(),filename=(null)
11-07 20:02:29.019: E/Godfrey5(5234): BitmapFactory.java, decodeStream()
11-07 20:02:29.019: E/BitmapFactory(5234): Godfrey5==BitmapFactory.cpp, nativeDecodeAsset()
11-07 20:02:29.019: E/BitmapFactory(5234): Godfrey5==BitmapFactory.cpp, doDecode()
11-07 20:02:29.019: E/BitmapFactory(5234): Godfrey5==BitmapFactory.cpp, doDecode(),filename=(null)
11-07 20:02:29.049: W/dalvikvm(5234): threadid=1: thread exiting with uncaught exception (group=0x416d1438)
11-07 20:02:29.079: E/AndroidRuntime(5234): FATAL EXCEPTION: main
11-07 20:02:29.079: E/AndroidRuntime(5234): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.money.irl/com.money.irl.MainActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2062)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2087)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.app.ActivityThread.access$600(ActivityThread.java:133)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1198)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.os.Handler.dispatchMessage(Handler.java:99)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.os.Looper.loop(Looper.java:137)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.app.ActivityThread.main(ActivityThread.java:4777)
11-07 20:02:29.079: E/AndroidRuntime(5234): at java.lang.reflect.Method.invokeNative(Native Method)
11-07 20:02:29.079: E/AndroidRuntime(5234): at java.lang.reflect.Method.invoke(Method.java:511)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
11-07 20:02:29.079: E/AndroidRuntime(5234): at dalvik.system.NativeStart.main(Native Method)
11-07 20:02:29.079: E/AndroidRuntime(5234): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class fragment
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.app.Activity.setContentView(Activity.java:1867)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.money.irl.MainActivity.onCreate(MainActivity.java:15)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.app.Activity.performCreate(Activity.java:5008)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2026)
11-07 20:02:29.079: E/AndroidRuntime(5234): ... 11 more
11-07 20:02:29.079: E/AndroidRuntime(5234): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4030500 but found 0. You must have the following declaration within the <application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.google.android.gms.maps.internal.q.v(Unknown Source)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.google.android.gms.maps.internal.q.u(Unknown Source)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.google.android.gms.maps.MapFragment$b.cE(Unknown Source)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.google.android.gms.dynamic.a.a(Unknown Source)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-07 20:02:29.079: E/AndroidRuntime(5234): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.app.Activity.onCreateView(Activity.java:4663)
11-07 20:02:29.079: E/AndroidRuntime(5234): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
11-07 20:02:29.079: E/AndroidRuntime(5234): ... 21 more
该项目是使用 Google API 编译的,库( google-play-services_lib )已加载,并且 MainActivity.java 中没有添加任何代码(仅从 Eclipse 生成)。
我已经通过右键单击项目 > Android 工具 > 添加支持库添加了支持库,接受并安装。
当我尝试在我的手机(ZTE Blade 3 pro)上启动时,应用程序出错。如果我删除“