有人请帮助我,我有项目获得当前位置的纬度和经度。我从androidhive那里得到了这个项目。
当我对它进行编译时,我收到了错误
java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 4452000 but found 6587000. 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" />
我的androidmanifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.koenb_fashion_fix"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application
android:name="com.koen_bfashion.image.AppController"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<meta-data
android:name="android.app.default_searchable"
android:value=".SearchResultsActivity" />
</activity>
<activity android:name="SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="LoginLayout"></activity>
<activity android:name=".SearchResultsActivity" android:parentActivityName="com.koenb_fashion_fix.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity android:name="Tampil_Produk_Fragment"></activity>
<activity android:name="Transfer_Layout"></activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDG5xQBueWTP8GrXQbaRmnJdVZO73KwRAQ" />
<activity android:name="MainActivity2"></activity>
</application>
</manifest>
我确定API KEY是正确的,我添加了
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
并且google-play-service-lib的库是22 我很困惑,有人能告诉我为什么我仍然会收到这个错误吗?
答案 0 :(得分:0)
您还需要包含应用引用的Google Play服务版本。因此,只需添加对整数的引用,该整数存储在API_KEY元数据下方。
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDG5xQBueWTP8GrXQbaRmnJdVZO73KwRAQ" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
答案 1 :(得分:0)
您只需要在清单中添加gms版本信息:
<activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyDG5xQBueWTP8GrXQbaRmnJdVZO73KwRAQ" />
<activity android:name="MainActivity2"></activity>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
如果您未在元数据中添加android:name =“com.google.android.gms.version”,则会获取错误的值并出现错误:
您应用的AndroidManifest.xml中的元数据标记没有正确的值。预期4452000但发现6587000
答案 2 :(得分:0)
尝试传递值<meta-data android:name="com.google.android.gms.version"
android:value="6587000" />
,但这可能会导致某些api的错误