drawable/ic_launcher_foreground not found. How to find that xml file
23,743
Solution 1
I had the problem and the file did exist.
I went into the file and formatted the contents (aka made a change), and that fixed the build system recognising the file.
Solution 2
I solved it by deleting the project's Mipmap folders and creating the icon again by right clicking on the res / folder
Solution 3
If at all you delete the ic_launcher_foreground.xml
or ic_launcher_background.xml
files from your android project then no need to worry.
Simply,
- right click the drawable directory (inside res folder) and select New ---> Image Asset. (2 above named files will automatically be generated with the ic_laucher)
- then click next and finally finish.
Solution 4
It is because you have accidentally deleted ic_launcher_forground
or it is missing due to some reason
Its genererally present in your drawable folder
A quick fix is you can add this file and rebuild your project again ic_launcher_forground
Solution 5
I had the same problem too and I solved it by:
- Make a new project or open an existing one
- Copy the XML file
ic_launcher_foreground.xml
(v24) from that and paste it todrawable
.
Author by
Thrinadh Reddy
Updated on July 09, 2022Comments
-
Thrinadh Reddy almost 2 years
-
Akshay Katariya about 6 yearsThank you for downvote a comment with brief explanation would be really helpful...
-
fo2rist over 4 yearsnote that most of the described steps aren't required. The build is failing b/c the file is missing. To satisfy the requirements it's enough to create/copy any valid drawable (XML, JPG, PNG) give it name ic_launcher_foregroundand and place it in the drawables folder. Hope that helps.
-
João Rebelo about 4 yearsI had exactly this same problem.. weird is that the build system would not pick the file if I didn't manually change the .xml...
-
rolinger about 4 yearsI am attempting to do this and for some reason the
image asset
tool is not creating theic_launcher_foreground.xml
file - everything else looks to be in place. I used an actual image to create my icons - and selected the path to that image in theforeground
tabAsset Type Path
. When I clicknext
is shows me all the output directories/files to be created - theic_launcher_foreground.xml
file is not listed anywhere, onlydrawable/ic_launcher_background.xml
,mipmap-anydpi-v26/ic_launcher.xml
andmipmap-anydpi-v26/ic_launcher_round.xml
-
Adi B almost 4 yearsAfter banging my head against the wall for 30 mins, and recreating the assets multiple times, this is what solved it for me. Opened the 'existing' foreground xml, pressed enter at end of tag, and rebuilt. And it's working now. Loco!!
-
Herii over 2 yearsWorked for me. Although the instructions could be clearer: After clicking right click on the res folder > New > Image asset
-
paakjis over 2 yearsyep, that worked.
-
Pascal over 2 yearsjup that helped ... there must be a dump cache somewhere
-
aaronsti about 2 yearsThis worked for me each time. I am complete novice, usually iOS, so thanks!