Manifest.xml错误我根本不知道

时间:2014-07-18 06:30:05

标签: java android

我根本不知道.. 我用的各种方法都没解决

07-18 15:09:15.697: E/AndroidRuntime(22016): FATAL EXCEPTION: main
07-18 15:09:15.697: E/AndroidRuntime(22016): java.lang.RuntimeException: Unable to start activity ComponentInfo{kr.co.crooz.plugin.googleplustestplugin/kr.co.crooz.plugin.googleplustestplugin.AndroidGooglePlus}: 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-18 15:09:15.697: E/AndroidRuntime(22016):    at dalvik.system.NativeStart.main(Native Method)
07-18 15:09:15.697: E/AndroidRuntime(22016): 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" />

AndroidGooglePlus.java 代码中的onCreate(Bundle savedInstanceState)

    setContentView(R.layout.activity_main)

的Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="kr.co.crooz.plugin.googleplustestplugin"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity 
            android:name="kr.co.crooz.plugin.googleplustestplugin.AndroidGooglePlus" 
            android:label="@string/app_name"
            android:configChanges="orientation">
           <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
           <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
        </activity>
    </application>

</manifest>

我需要帮助。请。

元数据android:name =“com.google.android.gms.version”android:value =“@ integer / google_play_services_version”

虽然代码仍然发生错误。

1 个答案:

答案 0 :(得分:2)

您需要将<meta-data>标记移到<activity>标记之外和<application>标记内。

喜欢这样。

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    >
    <activity 
       ......
     ......
    </activity>

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

</application>