简体   繁体   中英

How to fix the error “Unsupported type 'uses-permission'” in the Android Manifest file

I'm following an Android MySQL tutorial ( https://www.simplifiedcoding.net/android-mysql-tutorial-to-perform-basic-crud-operation/#Creating-Helper-Classes ) and the aim is to build an Android app connected to a MySQL database on an Apache server (XAMPP package). I use Android Studio (3.0.1) in order to develop the Android part.

I get an issue when I try to run the code, in my Android Manifest file (which allows the app to access the internet). The error is "Unsupported type 'uses-permission'" as said in the title. I've tried to look for common mistakes such as misspellings or if the permission I was asking for in my code indeed existed, but I couldn't find anything useful to fix it. And I didn't ask on the website of the tutorial because it looks pretty unlikely that I would get an answer (the last comment on the tutorial was on October 28th 2015), I've also looked at the comments and nobody seems to have got a similar issue.

Here is the code :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="ch.jemili.yasmina.myheroapp">

    <!-- this is the internet permission -->
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        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">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

For some reason, you have a manifest file in app/src/main/res/values/AndroidManifest.xml in your project. That is not where the manifest goes. The manifest goes in app/src/main/AndroidManifest.xml .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM