当我检查googleplayservices的可用性时,应用程序崩溃

时间:2014-07-24 06:46:46

标签: android

我已将meta标记包含在我的清单文件中,并将我的playservices引用到工作区中......可能是什么问题?

07-24 02:41:40.787: E/AndroidRuntime(1427): Caused by: java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  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" />
07-24 02:41:40.787: E/AndroidRuntime(1427):     at com.google.android.gms.common.GooglePlayServicesUtil.x(Unknown Source)
07-24 02:41:40.787: E/AndroidRuntime(1427):     at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
07-24 02:41:40.787: E/AndroidRuntime(1427):     at com.example.gcm.MainActivity.checkPlayServices(MainActivity.java:49)
07-24 02:41:40.787: E/AndroidRuntime(1427):     at com.example.gcm.MainActivity.onCreate(MainActivity.java:24)
07-24 02:41:40.787: E/AndroidRuntime(1427):     at android.app.Activity.performCreate(Activity.java:5231)
07-24 02:41:40.787: E/AndroidRuntime(1427):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)

2 个答案:

答案 0 :(得分:0)

在应用程序标记下声明您的元标记: -

<application
    android:allowBackup="true"
    .................>

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

输入所需的整数或从整数文件中引用它

答案 1 :(得分:0)

您必须在meta-data标记内添加一个application标记,如您提供的logcat所示

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