PositivityRiven
PositivityRiven

Reputation: 289

Error : No resource found that matches the given name (at 'icon' with value '@drawable/icon')

Error : No resource found that matches the given name (at 'icon' with value '@drawable/icon').

This is my manifest... I'm extremely new to this, just started this morning and have no previous programming experience.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.asdf"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="19" />

 <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
 </application>
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name="ExampleActivity"
          android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
</application>

</manifest>

Upvotes: 28

Views: 106703

Answers (14)

Seyhak Ly
Seyhak Ly

Reputation: 146

You need to add icon.png through visual.

Resouces... / Dravable/ Add ///

Upvotes: 2

pablo rotem
pablo rotem

Reputation: 1

There's an even simpler solution - delete the cache folder at user/.android/built-cache and go back to android studio and sync with gradle again, if that still doesn't work delete the cache folder again, and restart android studio and re-import the project

Upvotes: 0

George Fonseca
George Fonseca

Reputation: 71

If you are 100% sure that directories and files are ok, have a look at the project location.

There is a limit on the path length of files in the Operating System. Perhaps this limit is being exceded in your project files.

Move the project to a shorter folder (say C:/MyProject) and try again!

This was the problem for me!

Upvotes: 6

Adrian Ber
Adrian Ber

Reputation: 21370

I also encountered this error. I have a Cordova application and the problem was that in config.xml I had a duplicated element <icon src="icon.png">, one pointing to an non-existing path.

Upvotes: 0

Sergey NN
Sergey NN

Reputation: 806

Trying to build HelloWorld app on Ubuntu 16.04. Got error with drawable/icon. Solution could be:

cp ./platforms/android/build/intermediates/exploded-aar/com.android.support/design/25.3.1/res/drawable/navigation_empty_icon.xml    ./platforms/android/build/intermediates/exploded-aar/com.android.support/design/25.3.1/res/drawable/icon.xml

So, it look like icon.xml file missed.

Upvotes: 0

Mr Stone
Mr Stone

Reputation: 35

In my case, I use Xamarin with Visual Studio 2013. I create Blank App (Android) then deploy without any code update.

You can try:

  • Make sure that icon.png (or whatever files mentioned in the application android:icon tag) is present in the drawable-hdpi folder inside res folder of Android project.

  • If it shows the error even if the icon.png is present,then remove the statement application android:icon from the AndroidManifest.xml and add it again.

  • Check your project folder's path. If it is too long, or contains space, or contains any unicode character, try to relocated.

Upvotes: 0

user24251
user24251

Reputation: 1

if cordova app copy a valid png file to

resources\android\icon.png

and then run

ionic resources --icon

Upvotes: 0

Kristaps Folkmanis
Kristaps Folkmanis

Reputation: 323

What solved the problem for me was - create a folder "drawable" in "..platforms/android/res/" and put "icon.png" in it.

Upvotes: 19

iman kazemayni
iman kazemayni

Reputation: 1343

i had this problem. i created a picture for my background with jpg format. before added this picture, i changed the format to png with rename the format. and then i got this error like you. i changed my format picture with picture editor like photoshop to png and replaced it with picture in my project and then i hadnt that error. sory for bad english

Upvotes: 0

onexf
onexf

Reputation: 3754

This happens when you have previously changed your icon or the ic_launcher; and when that ic_launcher no longer exists in your base folder.

Try adding a png image and giving the same name and then copy it to your drawable folder.Now re build the project.

Upvotes: 0

pperrin
pperrin

Reputation: 1497

Found this question. I was importing an old project into android studio and got the error.

The issue was eventually answered for me here mipmap drawables for icons

In the manifest it has

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
...

but @drawable has been superseded by @mipmap so needed changing to:

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
...

I put this answer here, as it may become a more common issue.

Upvotes: 47

anil
anil

Reputation: 2123

I've spent on this problem much time and as for me (for Intellij IDEA) the solution is to specify right path to res directory:

  • right click on project
  • click Modules in the left panel
  • select Android below your project name
  • in Structure tab set right path.

And don't forget to check all the paths in this tab!

I hope it will be helpful for somebody!

Upvotes: 4

Josh
Josh

Reputation: 6383

Yet another Googlemare Landmine.... Somehow, if you mess up, the icon line on your .gen file dies. (Empirical proof of mine after struggling 2 hours)

Insert a new icon 72x72 icon on the hdpi folder with a different name from the original, and update the name on the manifest also.

The icon somehow resurrects on the Gen file and voila!! time to move on.

Upvotes: 0

Illegal Argument
Illegal Argument

Reputation: 10338

Remove this line from your manifest:

<application android:label="@string/app_name" android:icon="@drawable/icon">

You have two application tags only one should be present.

Upvotes: 3

Related Questions