I am working on making an android app that uses the google maps API. I keep getting these errors and have no idea how to fix this. My lab partner is running the same code that I am running and his runs but mine gives me these errors. Any help will be appreciated.
Thank you! Here are the errors that I get:
11-04 00:40:52.512: E/AndroidRuntime(328): FATAL EXCEPTION: main
11-04 00:40:52.512: E/AndroidRuntime(328): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.googlemaps/com.example.googlemaps.MainActivity}: android.view.InflateException: Binary XML file line #17: Error inflating class fragment
11-04 00:40:52.512: E/AndroidRuntime(328): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.os.Handler.dispatchMessage(Handler.java:99)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.os.Looper.loop(Looper.java:123)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-04 00:40:52.512: E/AndroidRuntime(328): at java.lang.reflect.Method.invokeNative(Native Method)
11-04 00:40:52.512: E/AndroidRuntime(328): at java.lang.reflect.Method.invoke(Method.java:507)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-04 00:40:52.512: E/AndroidRuntime(328): at dalvik.system.NativeStart.main(Native Method)
11-04 00:40:52.512: E/AndroidRuntime(328): Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class fragment
11-04 00:40:52.512: E/AndroidRuntime(328): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.app.Activity.setContentView(Activity.java:1657)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.example.googlemaps.MainActivity.onCreate(MainActivity.java:13)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
11-04 00:40:52.512: E/AndroidRuntime(328): ... 11 more
11-04 00:40:52.512: E/AndroidRuntime(328): 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-04 00:40:52.512: E/AndroidRuntime(328): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.google.android.gms.maps.internal.q.v(Unknown Source)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.google.android.gms.maps.internal.q.u(Unknown Source)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.google.android.gms.maps.SupportMapFragment$b.cE(Unknown Source)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.google.android.gms.maps.SupportMapFragment$b.a(Unknown Source)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.google.android.gms.dynamic.a.a(Unknown Source)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
11-04 00:40:52.512: E/AndroidRuntime(328): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:284)
11-04 00:40:52.512: E/AndroidRuntime(328): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
11-04 00:40:52.512: E/AndroidRuntime(328): ... 20 more
您必须将其添加到清单文件中的application标记中:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
I think you need to add your api key in Android Manifest File:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YOUR MAP API KEY HERE"/>
Import the gms library from the sdk tools so that you have used the latest version of the google maps service
Dont forget to the intiate the gms service at the application in the manifest file
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.