Skip to content

XmlException when building the template Android project #5992

Closed

Description

@wli3

Issue moved from dotnet/sdk#17946


From @tikotus on Friday, May 28, 2021 8:18:00 AM

I'm trying to create a fresh android template project but am unable to build it due to an exception. There is no obvious issue with the project. The same issue was not happening to me before on another device, but that might also have been using some other version of the Android workload.

Device:
MacBook Air (M1, 2020)

Steps:
Install .NET 6 Preview 4 (6.0.100-preview.4.21255.9)
Install Android workload: sudo dotnet workload install microsoft-android-sdk-full --skip-manifest-update
Create new project: dotnet new android
Build project: dotnet build

Exception occurs:
/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/11.0.200-preview.4.245/tools/Xamarin.Android.Tooling.targets(64,5): error XARSD7000: System.Xml.XmlException: Root element is missing.

Thins I've tried:
Poking at different XML files in the project
Removing and re-installing dotnet
Tried both x64 and Arm64 versions of .NET

Only yesterday the template project was working for me on another device (MacBook Air 2018) but I no longer have the device and can't validate if it's somehow reproducible.

Activity

  1. wli3 commented on Jun 3, 2021

    @wli3
    Author

    Issue moved from dotnet/sdk#17946

    • Please respond to @dotnet-issue-labeler[bot].

    From @dotnet-issue-labeler[bot] on Friday, May 28, 2021 8:18:03 AM

    I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

  2. added this to the One .NET milestone on Jun 4, 2021
  3. jonathanpeppers commented on Jun 4, 2021

    @jonathanpeppers
    Member

    @tikotus is this the error you're seeing?

    dotnet/android-tools#120

    What is the output of this command in your terminal?

    $ /usr/libexec/java_home -X
    
  4. tikotus commented on Jun 4, 2021

    @tikotus

    Yes, that was the error.
    Anyways, I'm no longer able to reproduce the issue. Building the template android project now works for me. This is most likely because I've since installed JDK (didn't realise I was missing it), since missing java was the problem in the other issue you posted. I can't verify if installing JDK is what fixed it, since I didn't try building right after installing JDK.

  5. jonathanpeppers commented on Jun 4, 2021

    @jonathanpeppers
    Member

    Ok, hopefully we'll get the above fix and next time you'll get an error message that says "there is no JDK installed" instead of the XmlException.

  6. jonathanpeppers commented on Jun 14, 2021

    @jonathanpeppers
    Member

    This was fixed in ceca993.

    It bumped to a version of xamarin-android-tools that has this fix. It should be in .NET 6 Preview 6.

  7. ghost locked as resolved and limited conversation to collaborators on Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area: App+Library BuildIssues when building Library projects or Application projects.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions