WingsOfAltair
WingsOfAltair

Reputation: 133

Visual studio 2019 Android - unexpected element <uses-permission> found in <manifest><application>

I am getting this error when I hit build solution or build project in Visual Studio 2019 Android (Xamarin). What can I do to fix this?

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

I expect it to build. Instead, I get:

Severity    Code    Description Project File    Line    Suppression State
Error       unexpected element <uses-permission> found in <manifest><application>.  DeepSound   D:\ProjectFolder\ProjectName\obj\Debug\90\android\manifest\AndroidManifest.xml  41

Full manifest file: https://pastebin.com/wwrkuCMK

Upvotes: 0

Views: 2657

Answers (4)

bhavya joshi
bhavya joshi

Reputation: 1136

App permissions should be under <manifest> and not <Application>

Upvotes: 2

Cheesebaron
Cheesebaron

Reputation: 24470

The error indicates that you have put your permissions inside of the <Application> tag. They should be outside in the root <manifest>. Remove them and it will get happy again.

Upvotes: 4

WingsOfAltair
WingsOfAltair

Reputation: 133

I added

android:maxSdkVersion="28"

to the lines and it worked.

<uses-permission android:name="android.permission.CAMERA" android:maxSdkVersion="28"/>

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28"/>

Upvotes: 0

Swayangjit
Swayangjit

Reputation: 1881

You have an extra set of following in line number 41 in pastebin which is causing the issue.

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Upvotes: 0

Related Questions