Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no AndroidResource build action in Maui #1500

Closed
plequere-ms opened this issue May 22, 2023 · 10 comments · Fixed by #1508
Closed

There is no AndroidResource build action in Maui #1500

plequere-ms opened this issue May 22, 2023 · 10 comments · Fixed by #1508
Assignees
Labels
doc-bug Problem with the content; needs to be fixed [org] dotnet-maui/tech dotnet-mobile/prod Pri2 📌 seQUESTered Identifies that an issue has been imported into Quest.

Comments

@plequere-ms
Copy link

plequere-ms commented May 22, 2023

The "Selective Backup" section appears to have been copied and pasted from the old Xamarin docs. There is no AndroidResource build action in Maui. The build action should be left as None.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 92649

@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label May 22, 2023
@plequere-ms plequere-ms changed the title There is no AndroidResource build action in Maui. There is no AndroidResource build action in Maui May 22, 2023
@davidbritch
Copy link
Contributor

Hi @plequere-ms

There is an AndroidResource build action:

image

I think the issue here is that the text wasn't fully updated in the move from Xamarin.Essentials to .NET MAUI. What currently says "Create a new XML file named auto_backup_rules.xml in the Resources/xml directory..." should be "Create a new XML file named auto_backup_rules.xml in the Platforms/Android/Resources/xml directory..."

@davidbritch davidbritch added the doc-bug Problem with the content; needs to be fixed [org] label May 23, 2023
@dotnet-bot dotnet-bot removed the ⌚ Not Triaged Not triaged label May 23, 2023
@plequere-ms
Copy link
Author

plequere-ms commented May 23, 2023

Hi @davidbritch.

I don't see this option.

image

I also checked colors.xml and the properties are as follows:

image

They're default properties. The settings in colors.xml do work.

@davidbritch
Copy link
Contributor

davidbritch commented May 23, 2023

Hi @plequere-ms

I just created a new MAUI project in 17.6.1 and looked at the build actions available on colors.xml. There are multiple Android* properties, which is what I'd expect:

image

@davidbritch
Copy link
Contributor

To clarify, AndroidResource was already set as the build action on colors.xml.

@plequere-ms
Copy link
Author

plequere-ms commented May 24, 2023

Okay, I got to the bottom of this.

The AndroidResource Build Action only shows up if the project targets Android in a generic manner:

<TargetFrameworks>net7.0-android;net7.0-ios</TargetFrameworks>

It does not show up if I target a specific version, such as:

<TargetFrameworks>net7.0-ios;net7.0-android33.0</TargetFrameworks>

Is this a bug or a feature?

@davidbritch
Copy link
Contributor

It's a known issue (whether it's a bug or feature is debatable), which is why it gets no mentions in the docs. When you use net7.0-android it picks the default for you, which right now is net7.0-android33.0. The recommendation from the engineers (discussed last week) is to always use net7.0-android.

@davidbritch
Copy link
Contributor

@plequere-ms After discussing this internally, it's apparently a bug that needs logging on Developer Community.

@davidbritch davidbritch self-assigned this May 25, 2023
@davidbritch davidbritch added the 🗺️ reQUEST Triggers an issue to be imported into Quest. label May 25, 2023
@github-project-automation github-project-automation bot moved this from 🔖 Ready to ✅ Done in dotnet/docs-maui 2023 Sprints May 25, 2023
@github-actions github-actions bot added 📌 seQUESTered Identifies that an issue has been imported into Quest. and removed 🗺️ reQUEST Triggers an issue to be imported into Quest. labels May 26, 2023
@mcmcelro
Copy link

This bug is worse than just specifying a particular version of Android. In my project, if I use:

<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>

I see several Android-specific build actions (AndroidAsset, AndroidBoundLayout, AndroidNativeLibrary, AndroidResource, AndroidAotProfile, AndroidGradleProject, ...).

However, if I swap it so that Android is not the first item:

<TargetFrameworks>net9.0-ios;net9.0-android</TargetFrameworks>

Suddenly, all of those Android-specific build actions vanish and the files in Platforms\Android\Resources all get a build action of None.

@mcmcelro
Copy link

mcmcelro commented Dec 18, 2024

Additionally, all of the tooling for Android platform-specific files, like the UI builder for Android layouts, was unavailable unless net9.0-android was listed first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-bug Problem with the content; needs to be fixed [org] dotnet-maui/tech dotnet-mobile/prod Pri2 📌 seQUESTered Identifies that an issue has been imported into Quest.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants