Errore nel frammento di classe di gonfiaggio e tag meta-data-data in AndroidManifest della tua app non ha il giusto valore
Domanda
Sto provando Google Maps, quindi ha scaricato il progetto Google Maps dal seguente link
Ho già messo la chiave API in manifesto.
Ma fornisce il seguente seguente errore
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)
.
Ho già dato la chiave API Mainfeast ed estendi la mia attività alla frammentazione
Plz aiutami.
My 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>
.
Soluzione
Prova ad aggiungere tag <meta-data>
sotto il tag <application>
nel tuo file manifest.xml
come
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
.
crea il tuo manifest.xml
come questo
....<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>
.
e dammi feedback su questo
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow