android 清单中所需的元数据标记不存在

A required meta data tag in your android manifest does not exist

大家好我想在我的应用程序中使用 google 登录,我遇到了这个错误,然后我做了 logcat 说的:

A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the element: meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"

但仍然出现同样的错误。

这是清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.deathstroke.uniqueoff1">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
    android:name=".Calligraphy"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:replace="android:allowBackup">

这是我添加到此文件的元数据:

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

这是文件的其余部分:

    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_test_navigation_drawer"
        android:screenOrientation="portrait"
        android:theme="@style/AppTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".SignUpActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".SingInActivity"
        android:screenOrientation="portrait" />
    <activity
        android:name=".CooperationActivity"
        android:screenOrientation="portrait" />

</application>

</manifest>

那怎么了?

在清单文件中添加以下元标记后

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

确保 “@integer/google_play_services_version”在自定义值文件中定义如下: 在/res/values/strings.xml

<?xml version="1.0" encoding='utf-8' standalone='no'?>

<integer name="google_play_services_version">12451000</integer>

</resources>

如果问题仍然存在,请告诉我