Error: unexpected element <receiver> found in <manifest>

stesvisstesvis USMember ✭✭✭
edited October 9 in Xamarin.Forms

Suddenly I get this build error in VS 2019 but not in VS 2017 when I build my Android project:
unexpected element <receiver> found in <manifest>

And this is what those lines look like:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.0.26" android:versionCode="148" package="ca.levitica.livedispatch.staging" android:installLocation="auto">
  <!-- Other stuff -->
  <receiver android:name=".BootReceiver" android:enabled="true">
    <intent-filter>
      <action android:name="android.intent.action.BOOT_COMPLETED"></action>
    </intent-filter>
  </receiver>
  <!-- Other stuff -->
</manifest>

What can I do? Thanks!

Best Answer

Answers

  • PatrickSlotPatrickSlot USMember

    Is the receiver element inside the application element?

  • IanCarrollIanCarroll Member

    I have the same issue.

    Visual studio is putting the code in itself. The bottom of the manifest file looks like this. The error being on line 81.














    When I remove the whole receiver block VS2019 puts it back in.
    I have tried moving it inside the but again VS2019 moves it back outside.

    Don't want to have to go back to VS2017.

  • stesvisstesvis USMember ✭✭✭
    > @PatrickSlot said:
    > Is the receiver element inside the application element?

    No it was not. I will try to move it manually like @DarrenS said and try! Thank you!
  • stesvisstesvis USMember ✭✭✭

    @PatrickSlot and @DarrenS you are both right, moving that element allows me to compile now.
    Thank you!

Sign In or Register to comment.