简体   繁体   中英

AndroidManifest.xml merger failing, cached intermediate file Visual Studio Xamarin Forms Android

Strange problem with Manifest Merger, Visual Studio Mac, Xamarin Forms (5.0.0.2125), Android project, SDK 29 to 30. Problem initiated from an extra ">" in the Properties/AndroidManifest.xml file. That generated the error below, indicating the xml structure wasn't closed; line 35, column 11 being was the last line and character of the Properties/AndroidManifest.xml.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(3,3): Error AMM0000: Error: org.xml.sax.SAXParseException; lineNumber: 35; columnNumber: 11; XML document structures must start and end within the same entity. (AMM0000)

So, I edited out the extra character, and the obj/debug/AndroidManifest.xml is created and looks right, however, the build error remains the same!

Subsequent complete rewrites and edits of the Properties/AndroidManifest.xml file have only 2 outcomes

  1. Entering an erroneous xml format will generate the appropriate errors describing the error.
  2. Entering a correct xml format, with any combination of entries, lines and characters will generate a correct obj/debug/AndroidManifest.xml file with the the correct Properties/AndroidManifest.xml content. However, the original build errors stay, with the " line 35, column 11 being was the last line and character of the Properties/AndroidManifest.xml." error.

So, something cached, somewhere, but no clue where. Started during an aborted simulator build and has been here ever since.

Have tried quite few things including:

  • cleaning, rebuilding and many combinations
  • remove obj and bin
  • removing/adding declarations in the AndroidManifest.xml
  • using different AndroidManifest.xml files
  • deleting AndroidManifest.xml and running
  • restoring from cloud a different version of solutions
  • commenting out Activity declaration on MainActivity
  • reinstall of VS for Mac

I think it is similar to this bug Xamarin android Manifest being replaced on build. only solution seems to be to repair visual studio

Has anyone seen this type of bug before?
Help much appreciated as have run out of ideas here.

AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="17" android:versionName="1.17" package="com.mycompany.myapp">
    <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="30" />
    <application android:label="myapp" android:icon="@mipmap/ic_launcher" android:supportsRtl="true"></application>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
</manifest>

Solved here, github.com/xamarin/xamarin-android/issues/6385. Was a problem in a Nuget Firebase library AndroidManifest.xml file. Unfortunately the error reporting in VS Mac Manifest merging doesn't report which of the 140+ AndroidManifest.xml files has the problem. However, with a bit of sleuthing, there is a way to eventually work it out.

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