El error al inflar el fragmento de clase y la etiqueta de metadatos en el AndroidManifest de su aplicación no tiene el valor correcto
Pregunta
Estoy probando Google Maps, así que descargué el proyecto de Google Maps desde el siguiente enlace.
Ya puse la clave API en Manifest.
Pero me da el siguiente error
java.lang.RuntimeException: Unable to start activity ComponentInfo{in.wptrafficanalyzer.locationgeocodingapiv2/in.wptrafficanalyzer.locationgeoc
odingapiv2.MainActivity}: android.view.InflateException: Binary XML file line #24:Error inflating class fragment
04-11 16:09:55.679: E/AndroidRuntime(3510): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
04-11 16:09:55.679: E/AndroidRuntime(3510):at android.app.ActivityThread.performLaunchActivity (Activity Thread .java: 1651)
04-11 16:09:55.679: E/AndroidRuntime(3510): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
04-11 16:09:55.679: E/AndroidRuntime(3510): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-11 16:09:55.679: E/AndroidRuntime(3510):at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
04-11 16:09:55.679: E/AndroidRuntime(3510): Caused by: android.view.InflateException: Binary XML file line #24: Error inflating class fragment
04-11 16:09:55.679: E/AndroidRuntime(3510): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:587)
04-11 16:09:55.679: E/AndroidRuntime(3510): at android.app.Activity.setContentView(Activity.java:1657)
04-11 16:09:55.679: E/AndroidRuntime(3510): at in.wptrafficanalyzer.locationgeocodingapiv2.MainActivity.onCreate(MainActivity.java:46)
04-11 16:09:55.679: E/AndroidRuntime(3510): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-11 16:09:55.679: E/AndroidRuntime(3510): Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4242000 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" />
04-11 16:09:55.679: E/AndroidRuntime(3510): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)
04-11 16:09:55.679: E/AndroidRuntime(3510): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
Ya le di la clave API mainfeast y extendí mi actividad a fragmentActivity
Por favor, ayúdame.
Mi AndroidMainfest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.wptrafficanalyzer.locationgeocodingapiv2"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<permission
android:name="in.wptrafficanalyzer.locationgeocodingapiv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="in.wptrafficanalyzer.locationgeocodingapiv2.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="package.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="MY API keY" />
</application>
Solución
Intenta agregar <meta-data>
etiqueta debajo <application>
etiqueta en tu manifest.xml
archivo como
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
Haz tu manifest.xml
como esto
....<application>
..............
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Key" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
y dame tu opinión sobre esto
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow