dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.05k stars 1.73k forks source link

Android : Resources/appicon.svg cannot be moved to Resources/Images/appicon.svg #6753

Closed nk54 closed 2 years ago

nk54 commented 2 years ago

Description

I want to put every image I use inside the Images folder.

But on the default project template, both appicon.svg ad appiconfg.svg are in the resources folder (at the root).

I tried to move them in Resources/Images. It works. At least I thought it worked. It works only if you compiled in the past and the generated files are still there in the bin folder.

Now, clean bin or clone the branch in another repo without any bin/debug files.

Build again, and now Android cannot be launched as VS doesn't find the images anymore.

Note : no problem on Windows

Steps to Reproduce

Create a new MAUI app. Move the appicon.svg and appiconfg.svg inside the Images folder.

Try to launch.

Version with bug

Release Candidate 2 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11

Did you find any workaround?

Put back the images at the root of Resource folder and forget to have a clean solution where Images are inside the Images folder......

Relevant log output

19>MAUI -> C:\_git\main\OpenPharmaMAUI\src\MAUI\bin\Debug\net6.0-android\MAUI.dll
19>C:\_git\main\OpenPharmaMAUI\src\MAUI\Platforms\Android\AndroidManifest.xml : error APT2260: resource mipmap/appicon (aka com.nomadvantage.openpharma.mobile:mipmap/appicon) not found.
19>C:\_git\main\OpenPharmaMAUI\src\MAUI\Platforms\Android\AndroidManifest.xml : error APT2260: 
19>C:\_git\main\OpenPharmaMAUI\src\MAUI\Platforms\Android\AndroidManifest.xml : error APT2260: This error is likely caused by an issue with the AndroidManifest.xml file or an Android manifest generation attribute in a source code file.
19>C:\_git\main\OpenPharmaMAUI\src\MAUI\Platforms\Android\AndroidManifest.xml : error APT2260: resource mipmap/appicon_round (aka com.nomadvantage.openpharma.mobile:mipmap/appicon_round) not found.
19>C:\_git\main\OpenPharmaMAUI\src\MAUI\Platforms\Android\AndroidManifest.xml : error APT2260: 
19>C:\_git\main\OpenPharmaMAUI\src\MAUI\Platforms\Android\AndroidManifest.xml : error APT2260: This error is likely caused by an issue with the AndroidManifest.xml file or an Android manifest generation attribute in a source code file.
19>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.300-rc.2.27\tools\Xamarin.Android.Aapt2.targets(217,3): error APT2067: failed processing manifest.
nk54 commented 2 years ago

Additionnal info : on Windows, it doesn't crash. But there is no icons

jfversluis commented 2 years ago

Possibly same or related: #5652

v-longmin commented 2 years ago

Verified repro on Android 12.0 with above steps.

mattleibow commented 2 years ago

I think this is a duplicate of #5652 and I think half the time when files are moved in VS the IDE decides it does not want to track the files and adds an explicit remove for everything.

Closing this as a result of the duplicate and the issue will be tracked there.

mattleibow commented 2 years ago

Improvements are happening here: https://github.com/dotnet/maui/pull/7968