Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AAPT: error: unexpected element <uses-permission> found in <manifest><application>

I am trying to create an android app for watchduino2.. When i follow the provided steps i encounter the error

AAPT: error: unexpected element <uses-permission> found in <manifest><application>

Can somebody explain this problem? And also help me to resolve it as well.

like image 794
Vijay Avatar asked May 26 '19 17:05

Vijay


People also ask

What permission should be added to the manifest file for accessing the camera hardware?

Manifest declarationsCamera Permission - Your application must request permission to use a device camera. Note: If you are using the camera by invoking an existing camera app, your application does not need to request this permission.

What type of permission in manifest file is required to write into external storage files uses permission android name Android permission?

The name of the permission. It can be a permission defined by the application with the <permission> element, a permission defined by another application, or one of the standard system permissions (such as "android. permission. CAMERA" or "android.


2 Answers

<uses-permission> needs to be a child of the root <manifest> element. You have it as a child of the <application> element. So, move the <uses-permission> element.

So, you have something like:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="net.whatever">
    <application android:icon="@drawable/icon"
                 android:debuggable="true"
                 android:label="@string/app_name">
        <uses-permission android:name="android.permission.INTERNET"/>
      <!-- other stuff here -->
    </application>
</manifest>

It needs to be more like:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="net.whatever">
    <uses-permission android:name="android.permission.INTERNET"/>
    <application android:icon="@drawable/icon"
                 android:debuggable="true"
                 android:label="@string/app_name">
      <!-- other stuff here -->
    </application>
</manifest>
like image 176
CommonsWare Avatar answered Oct 05 '22 01:10

CommonsWare


it might be about misplaced tag, make sure your manifest elements are nested correctly

Previous versions of AAPT would simply ignore the misplaced tag. However, with AAPT2, you will get error

read below official document for proper Manifest structure :

Manifest File Structure

like image 23
Russell Ghana Avatar answered Oct 05 '22 00:10

Russell Ghana