Home » Android » android – drawable/ic_launcher_foreground not found. How to find that xml file

android – drawable/ic_launcher_foreground not found. How to find that xml file

Posted by: admin June 15, 2020 Leave a comment

Questions:

Gradle build is not successful because it cannot find ic_launcher_foreground.xml in drawable.

Here are the error messages

Actual error occured in this file

How to&Answers:

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,

  1. 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)
  2. then click next and finally finish.

Answer:

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
enter image description here

A quick fix is you can add this file and rebuild your project again ic_launcher_forground

Answer:

I had the same problem too and I solved it by:

  1. Make a new project or open an existing one
  2. Copy the XML file ic_launcher_foreground.xml (v24) from that and paste it to drawable.

Answer:

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.

Answer:

Please check your drawable folder ic_launcher_forground file is missing

enter image description here

Rebuild your project again.