Skip to content

Problem adding a drawable to a net7.0-android project #7600

@gmck

Description

@gmck

Android application type

Android for .NET (net6.0-android, etc.)

Affected platform version

VS 2022 17.5.0 Prev 1

Description

I’ve successfully converted one of my test apps. I started on a second app this morning with the idea of trying to find the fastest possible way of converting an existing xamarin.android into a net7.0-android app by starting with the application template.
I start with what appeared to be reasonable with the previous project, but I was attempting to get there by first getting all the resources over and building them successfully before attempting to add any code.

So create an app with the template, and make sure it builds and runs.

Then I change the namespace by using the old one and adding “net7” to it, and add “net7” to the application name so that both apps can be side by side in the app drawer.

So basically I delete the contents of the Resources of the new template app and start adding the Resources from the xamarin.android app Resources folder. Eg. anim, drawable, menu, navigation etc.

If you have the .csprog file open you see a new ItemGroup and a Folder include for each folder e.g.

<ItemGroup>
	  <Folder Include="Resources\drawable\" />
	  <Folder Include="Resources\navigation\" />
	  <Folder Include="Resources\menu\" />
</ItemGroup>

Then when you start adding the actual resources here it changes to a new ItemGroup and the individual Folder item of the one you just added disappears.

<ItemGroup>
	  <None Remove="Resources\anim\slide_in_left.xml" />
	  <None Remove="Resources\anim\slide_in_right.xml" />
	  <None Remove="Resources\anim\slide_out_left.xml" />
	  <None Remove="Resources\anim\slide_out_right.xml" />
</ItemGroup>

However, if I add webp images from the other project’s drawable folder. The Folder Include For Resources\drawable disappears, but the <None Remove doesn’t get the 3 webp files that just appeared in the project. Any of the other xml drawables that were in the old project drawable folder are correctly added to the None Remove part, but the 3 webp files aren’t.

Consequently when after you added the Themes.xml file to the values folders that refer to those webp files you get a heap of errors. Can’t find etc.

I’m presuming this is not meant to work like this. But I can’t proceed any further with this conversion. Can you suggest a workaround?

The project I’m trying to convert is https://github.com/gmck/NavigationGraph7. Also the app I did convert successfully is. https://github.com/gmck/NavigationGraph2Net7

Steps to Reproduce

See above

Did you find any workaround?

No

Relevant log output

No response

Metadata

Metadata

Labels

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

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions