Java Android编译器可以';即使元数据存在于清单文件中,也找不到它

Java Android编译器可以';即使元数据存在于清单文件中,也找不到它,java,android,android-studio,Java,Android,Android Studio,我正在试着运行谷歌云消息系统,logcat告诉我 元数据应该包括android名称和android值,这已经是 存在于清单中 3016-3016/com.icanappz.gcmimplementation E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.icanappz.gcmimplementation, PID: 3016 java.lang.RuntimeException: Unable to start ac

我正在试着运行谷歌云消息系统,logcat告诉我 元数据应该包括android名称和android值,这已经是 存在于清单中

3016-3016/com.icanappz.gcmimplementation E/AndroidRuntime﹕ FATAL   EXCEPTION: main


 Process: com.icanappz.gcmimplementation, PID: 3016
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.icanappz.gcmimplementation/com.icanappz.gcmimplementation.MainActivity}: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 6587000 but found 6171000.  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" />
    at   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
    at android.app.ActivityThread.access$800(ActivityThread.java:144)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
 Caused by: java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 6587000 but found 6171000.  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" />
        at com.google.android.gms.common.GooglePlayServicesUtil.D(Unknown Source)
        at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)
        at com.icanappz.gcmimplementation.MainActivity.onCreate(MainActivity.java:112)
        at android.app.Activity.performCreate(Activity.java:5933)
3016-3016/com.icanappz.gcm实施E/AndroidRuntime﹕ 致命异常:主
流程:com.icanappz.gcmi实现,PID:3016
java.lang.RuntimeException:无法启动活动组件信息{com.icanappz.gcmiImplementation/com.icanappz.gcmiImplementation.MainActivity}:java.lang.IllegalStateException:应用程序的AndroidManifest.xml中的元数据标记没有正确的值。预计为6587000,但发现为6171000。元素中必须有以下声明:
在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)上
在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)上
在android.app.ActivityThread.access$800(ActivityThread.java:144)
在android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
位于android.os.Handler.dispatchMessage(Handler.java:102)
位于android.os.Looper.loop(Looper.java:135)
位于android.app.ActivityThread.main(ActivityThread.java:5221)
位于java.lang.reflect.Method.invoke(本机方法)
位于java.lang.reflect.Method.invoke(Method.java:372)
在com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)上
位于com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
原因:java.lang.IllegalStateException:应用程序的AndroidManifest.xml中的元数据标记没有正确的值。预计为6587000,但发现为6171000。元素中必须有以下声明:
位于com.google.android.gms.common.GooglePlayServicesUtil.D(未知来源)
位于com.google.android.gms.common.GooglePlayServicesUtil.isgoogleplayservicesavaailable(未知来源)
位于com.icanappz.gcmiimplementation.MainActivity.onCreate(MainActivity.java:112)
位于android.app.Activity.performCreate(Activity.java:5933)
这是日志,这是最主要的:

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

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="21" />

    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <!-- This app has permission to register and receive data message. -->
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    <!-- Permission to vibrate -->
    <uses-permission android:name="android.permission.VIBRATE" />

    <!-- Creates a custom permission so only this app can receive its messages. -->
    <permission
        android:name="com.icanappz.gcmimplementation.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.icanappz.gcmimplementation.permission.C2D_MESSAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/icanTheme" >
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version"/>
        <activity
            android:name="com.icanappz.gcmimplementation.MainActivity"
            android:theme="@style/Theme.AppCompat.Light"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.icanappz.gcmimplementation.DailogeNotice"
            android:theme="@style/AppTheme.Dialog" >
        </activity>
        <activity
            android:name="com.icanappz.gcmimplementation.CustomeWebView"
            android:theme="@style/Theme.AppCompat.Light" >
        </activity>

        <activity
            android:name="com.icanappz.gcmimplementation.PreferenceActivity"
            android:theme="@style/Theme.AppCompat.Light" >
        </activity>

        <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />





        <receiver
                android:name="com.icanappz.gcmimplementation.GcmBroadcastReceiver"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>

                <!-- Receives the actual messages. -->
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />

                <category android:name="com.icanappz.gcmimplementation" />
            </intent-filter>
        </receiver>

        <service     android:name="com.icanappz.gcmimplementation.GcmIntentService" />
    </application>

</manifest>

您没有收到错误消息。它说:

原因:java.lang.IllegalStateException:数据库中的元数据标记 应用程序的AndroidManifest.xml没有正确的值。预期 6587000,但发现6171000。您必须具有以下声明 在元素内:

expected 6587000 but found 6171000.
这一点至关重要。这仅仅意味着你重新构建了你的应用程序,比你试图运行应用程序的设备/仿真器(6171000)上安装的版本(6587000)更新

我也有一些担心,你得到了不正确的代码来处理这种情况,因为你应该告诉用户这一点,并要求升级,而不是崩溃。事实上,您应该了解类,尤其是正确处理返回的代码:

if( GooglePlayServicesUtil.isUserRecoverableError( errorCode ) ) {
    GooglePlayServicesUtil.getErrorDialog(errorCode, null, requestCode)
}
每当发生用户可恢复的错误时,包括:

ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
ConnectionResult.SERVICE_MISSING
ConnectionResult.SERVICE_DISABLED
ConnectionResult.SERVICE_INVALID

您没有收到错误消息。它说:

原因:java.lang.IllegalStateException:数据库中的元数据标记 应用程序的AndroidManifest.xml没有正确的值。预期 6587000,但发现6171000。您必须具有以下声明 在元素内:

expected 6587000 but found 6171000.
这一点至关重要。这仅仅意味着你重新构建了你的应用程序,比你试图运行应用程序的设备/仿真器(6171000)上安装的版本(6587000)更新

我也有一些担心,你得到了不正确的代码来处理这种情况,因为你应该告诉用户这一点,并要求升级,而不是崩溃。事实上,您应该了解类,尤其是正确处理返回的代码:

if( GooglePlayServicesUtil.isUserRecoverableError( errorCode ) ) {
    GooglePlayServicesUtil.getErrorDialog(errorCode, null, requestCode)
}
每当发生用户可恢复的错误时,包括:

ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
ConnectionResult.SERVICE_MISSING
ConnectionResult.SERVICE_DISABLED
ConnectionResult.SERVICE_INVALID

您没有收到错误消息。它说:

原因:java.lang.IllegalStateException:数据库中的元数据标记 应用程序的AndroidManifest.xml没有正确的值。预期 6587000,但发现6171000。您必须具有以下声明 在元素内:

expected 6587000 but found 6171000.
这一点至关重要。这仅仅意味着你重新构建了你的应用程序,比你试图运行应用程序的设备/仿真器(6171000)上安装的版本(6587000)更新

我也有一些担心,你得到了不正确的代码来处理这种情况,因为你应该告诉用户这一点,并要求升级,而不是崩溃。事实上,您应该了解类,尤其是正确处理返回的代码:

if( GooglePlayServicesUtil.isUserRecoverableError( errorCode ) ) {
    GooglePlayServicesUtil.getErrorDialog(errorCode, null, requestCode)
}
每当发生用户可恢复的错误时,包括:

ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
ConnectionResult.SERVICE_MISSING
ConnectionResult.SERVICE_DISABLED
ConnectionResult.SERVICE_INVALID

您没有收到错误消息。它说:

原因:java.lang.IllegalStateException:数据库中的元数据标记 应用程序的AndroidManifest.xml没有正确的值。预期 6587000,但发现6171000。您必须具有以下声明 在元素内:

expected 6587000 but found 6171000.
这一点至关重要。这仅仅意味着你重新构建了你的应用程序,比你试图运行应用程序的设备/仿真器(6171000)上安装的版本(6587000)更新

我也有一些担心,你得到了不正确的代码来处理这种情况,因为你应该告诉用户这一点,并要求升级,而不是崩溃。事实上,您应该了解类,尤其是正确处理返回的代码:

if( GooglePlayServicesUtil.isUserRecoverableError( errorCode ) ) {
    GooglePlayServicesUtil.getErrorDialog(errorCode, null, requestCode)
}
每当发生用户可恢复的错误时,包括:

ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
ConnectionResult.SERVICE_MISSING
ConnectionResult.SERVICE_DISABLED
ConnectionResult.SERVICE_INVALID

您需要将此元数据添加到
AndroidManifest.xml
内部


<