The <uses-permission> element must be a direct child of the <manifest> root element

余生颓废 提交于 2019-12-07 09:25:19

问题


I'm trying to run my android app but I'm getting the following error The element must be a direct child of the root element and The element type "application" must be terminated by the matching end-tag "". Can somebody write me the 'correct' version of it? Thanks.

This is my manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.daytraders"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.daytraders.Login"
            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>
    <activity android:label="@string/app_name" android:name="Profile">
        </activity>
        <activity android:label="Day Traders USER PANEL" android:name="Main">
        </activity>
    </application>
     <!-- Allow to connect with internet and to know the current network state-->
    <uses-permission android:name="android.permission.INTERNET">
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE">
  </uses-permission></uses-permission></manifest>

回答1:


here you go

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.daytraders"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <!-- Allow to connect with internet and to know the current network state -->
    <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.daytraders.Login"
            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="Profile"
            android:label="@string/app_name" >
        </activity>
        <activity
            android:name="Main"
            android:label="Day Traders USER PANEL" >
        </activity>
    </application>


</manifest>


来源:https://stackoverflow.com/questions/20792728/the-uses-permission-element-must-be-a-direct-child-of-the-manifest-root-elem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!