"ic_launcher cannot be resolved or is not a field"
Solution 1
replace "mipmap" with "drawable"
I had the same problem while following a tutorial and i found out that my AndroidManifest.xml file had the following code :-
android:icon="@mipmap/ic_launcher
so I changed R.drawable to R.mipmap it solved the problem . Wherever I found out drawable I replaced it with mipmap. Good to check for mipmap with android studio 1.1. for more info :-https://androidbycode.wordpress.com/2015/02/14/goodbye-launcher-drawables-hello-mipmaps/
Solution 2
Here is how I solved the problem:
In my program there had been android.R import so it was giving error for R.drawable.ic_launcher ....removing android.R import worked for me..!!!
Solution 3
Check top line of your activity if have an import of
import android.R
delete it and clean your app.
Admin
Updated on June 19, 2022Comments
-
Admin almost 2 years
I was following a tutorial of Android and When I was done everything, I got a problem in this code:
getDrawable(R.drawable.ic_launcher);
And I got the message
**"ic_launcher cannot be resolved or is not a field"**
What's more, my icon doesn't appear in tablet emulator, but starts automatic. What's going on?