2013-11-01 19 views
32

我的應用正在使用Google Play服務進行定位。它也在使用Google地圖。直到今天,它運行良好,但在Eclipse更新和Google Play Services v13安裝之後,它不再工作。今天我已經進行了幾次更新。 - Android SDK工具更新到22.3 - Android的SDK平臺工具更新到19 - Android的SDK構建的工具,更新至19個 - 更新至13 此外,我已經更新了ADTAndroidManifest中的Google Play Services v13錯誤元數據

谷歌Play服務,當我啓動應用程序我收到以下錯誤消息:

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" /> 

我已經多次使用Google Play服務工作,並且此應用一直運行良好,直到現在。我沒有在清單中包含任何元數據。

我試圖解決包括我的應用程序清單中的元數據標籤的問題,但它不工作。目前我的應用程序清單看起來像這樣(這與清單包含在我的應用程序中的清單一樣)。

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.myapp.app" 
android:versionCode="2" 
android:versionName="1.0.1" > 

<uses-feature 
android:glEsVersion="0x00020000" 
android:required="true" /> 

<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<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" /> 
<permission 
android:name="com.myapp.app.permission.MAPS_RECEIVE" 
android:protectionLevel="signature" /> 

<uses-permission android:name="com.myapp.app.permission.MAPS_RECEIVE" /> 

<supports-screens android:requiresSmallestWidthDp="320" /> 
<supports-screens android:compatibleWidthLimitDp="394" /> 


<uses-sdk 
android:minSdkVersion="16" 
android:targetSdkVersion="18" /> 

<application 
android:allowBackup="true" 
android:icon="@drawable/ic_launcher" 
android:label="@string/app_name" 
android:theme="@style/CustomizedTheme" > 

<meta-data 
android:name="com.google.android.maps.v2.API_KEY" 
android:value="thecode" /> 

<activity 
android:name="com.myapp.app.ActivityMain" 
android:label="@string/app_name" > 
<intent-filter> 
<action android:name="android.intent.action.MAIN" /> 
<category android:name="android.intent.category.LAUNCHER" /> 
</intent-filter> 
    </activity> 
</application> 

</manifest> 

我想知道如果這個問題是由於谷歌播放服務清單?

這是我發現的清單:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.google.android.gms" 
android:versionCode="4030530" 
android:versionName="4.0.30 (889083-30)" > 

<uses-sdk android:minSdkVersion="8"/> 

</manifest> 

要使用谷歌Play服務,我跟了由谷歌提供的說明,因爲在過去,到現在爲止我還沒有發現任何問題。

+0

[Google Play服務更新到版本13後出現錯誤]的可能重複(http://stackoverflow.com/questions/19723811/after-google-play-service-update-to-version- 13-I-got-an-error) – laalto

回答

71

Google Maps getting started guide說:

添加谷歌Play服務版本,您的應用程序的清單

編輯應用程序的AndroidManifest.xml文件,和元素中添加 以下聲明。這嵌入了 該應用程序編譯的Google Play服務的版本。

<meta-data 
     android:name="com.google.android.gms.version" 
     android:value="@integer/google_play_services_version" /> 
+1

我已經嘗試過這個解決方案,但是雖然應用程序不會崩潰,但它不起作用,因爲最新版本的Google Play可用是修訂版12.它似乎還沒有準備好。我用Froyo的Google Play服務運行。到目前爲止,我會用這個。我非常感謝你的幫助 – Javier

+0

是啊,它看起來像他們已經添加的新東西,將添加,以及我更新後,播放服務庫。 – meh

+1

在Logcat錯誤中,您可以看到必須在該元數據的值字段中輸入的數字,而不是版本號(最後是13),請檢查它。 – danigonlinea

7

,如果你使用谷歌播放服務的修訂13,然後必須把此meta標籤:

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> 

,但它不能正常工作水平較低的API,例如Android 2. *。 要解決這個問題,首先安裝谷歌播放服務frayo修訂版12並使用它。它適用於所有api級別

相關問題