Android Studio ic_launcher not found - android

after have created an icon for the app, android studio is avoiding it when I generate the apk file for release.
error: resource mipmap/ic_launcher (aka com.example.elrestaurante:mipmap/ic_launcher) not found.
error: resource mipmap/ic_launcher_round (aka com.example.elrestaurante:mipmap/ic_launcher_round) not found
My project has a git repo. Something rare happens when I do click over each file generated inside mipmap (this disappear), here you can see the issue. is a git repo conflict?
Here are the files:
I generated the icon from file->new->Image Asset.. and also I tested creating the icon doing right click over the res folder then new->Image Asset.
I will appreciate any idea to fix this problem.
thanks so much,

To be honest, you can delete mipmap and and ic_launcher directory, and then add the Image Asset again, that's what I've always been doing, cause for whatever reason if you add an image asset and another one exist, the previous one is not removed sometimes

Try This
you are put all icons in debug folder remove them from debug folder and put them outside
debug folder assets only work when you are app running in debug bug release time it's getting errors because the app can't find assets
folder structure like this shown in the below image

Check your folder structure where the files are located. As it shows debug, check whether there is debug and main in src folder.

Related

Assets in Android Studio can not be found

I have imported an existing Android Project from Eclipse into Android Studio. I had my assets like icons in the src/main/res folder. When I tried to run the app the following error occured:
Content is not allowed in prolog: my_logo.png
So I searched for a solution and found out that I should use "src/main/assets" instead of "src/main/res". I then created the assets folder by clicking on "File -> New -> Folder -> Assets Folder", moved the content of the res folder to the new assets folder and tried to run the app again. Now I am getting this error:
No resource found that matches the given name (at 'icon' with value '#drawable/my_logo').
It seems like Android Studio does not look inside the new assets folder for the resources. How can I fix this? Thanks a lot!
You shouldn't need the assets folder for image resources. Images should be placed inside a drawable folder in your project's res directory.
The reason it's not finding the image now is because #drawable looks for an image resource in the res/drawable/ folder.

Assets Folder Not Getting Added To Android Studio Project and APK

I'm trying to add an Assets folder to my Android Project in Android Studio 2.1.2. I right click on the project and choose New -> Folder -> Assets Folder. In the project pane on the left, it doesn't show up when Android is selected. If I switch to Project Files, it does appear, however it looks like a normal directory, rather than looking like a resource directory. I then tried adding files to it (jpgs), both through Android Studio and through the file explorer (all file names are lowercase with no special characters). If you unzip the apk that gets created though, it doesn't contain an Assets directory or the added files. Also sometimes the assets directory will disappear from the project files pane, although it's still in explorer.
What step am I missing to get to the Assets directory properly added to my project?
Note: this is for a LibGdx project that expects image files to be there.
Finally got it. Appears to be a bug in Android Studio, but to make it work, in the Project pane, go to Android view and (this next part is critical) right click on the res folder and go to New->Folder->Assets folder. You might want to click change folder location to be sure it's going into the main folder (mine was) just to be on the safe side.
You must right click on the res folder. That was my issue. If you right click on the module or anywhere else, even though the folder will get created in the proper spot, Android Studio and gradle won't treat it as a resource directory and just ignores it.
Be sure to create folder in app/src/main/ and call it assets.
For me in Android Studio 3.6.2, the assets folder wasn't showing up in the "Android" view, no matter where I tried to create it, after trying the other suggestions here. In the "Project" view it showed up in app/assets as a plain folder. I then drag-and-dropped it to src/main/assets and it automatically changed its icon to the same icon as the res folder, and after this it is now also showing up in the "Android" view, so I guess Android Studio is picking it up correctly now, and it appears to be a bug in Android Studio.
If you created a folder in your res directory and named it "assets" and now as "Nullqwerty" mentioned you could not able to solve your problem and you face to the duplication error, just go to the project tab (or press Alt + 1) and in the view mode, change it from "Android" to "Project", then expand all folders in your project to find assets folder in your src\main\res directory (or in src\main path) and right-click on your "assets" folder (if you created it before by adding a "Directory" and named it assets), then change your view mode from "Project" to "Android", again, and right-click on "res" directory->New->Folder->Assets Folder. Then click on "Finish" button to see the assets folder on your main directory as you want. That's it ;)

Android Studio newly created folders not showing

I am using Android Studio 2.1.1 (currently the most updated stable version).
I created new directory inside 'res' by name "values-21"
and it don't shows up.
But if I go to the physical location of 'res' on the hard drive I can see that its exist.
and of course I checked using both Android and Project Files structure but either way its not showing it.
I wanted to check where is the problem so I created another directory by name "menu", and the last one was shown.
just to be sure I tried to create the same directory again ("values-21") but Android studio didn't allowed it because this directory allready exist's.
any ideas how to fix it?
Update - the solution is to create new directory using the "Android resource Directory" option and not by "Directory" option.
all you values xml files stored in values, values-21, values-mdpi or other physical folder in AndroidStudio displayed in one res/values folder.
It will not show until you copy a XML file into values-21, android studio consider all values folders to be of same family and it shows only one folder and the files with post script of the family in which it lies.
copy some layout file from resource directory and through windows explorer paste in that the folder that you have created i.e values-21 and now come back to android studio and check the folder should be there.
Happy coding

Android Studio - XML Resource Error

I have added an assets in the root or main directory using Right Click > New > Folder > Assets
And then a sub-directory for the splash assets but when I add the asset via
android:src="#assets/splash_assest/RTBDevLogo.png"
I get an error that it's and Unknown resource type. I'm spent some time looking for answers and everything I find is for the older version of AS and will not work with my version 1.1.0 (newest as of 4/21/15)
Do I need to import it? Or something along those lines?
You cannot use assets like this. Try putting this image file in res/drawable/ and refer as android:src="#drawable/RTBDevLogo"

I changed a resource in Eclipse and the app displays the old resource

In my app, I decided to change a resource (a PNG file). So, I delete the old one and add the new one with the same name. However, when I run my app in both my phone and the emulator, I still see the old picture !!
I tried all these options:
Cleaning the project.
Refreshing the project folder.
Closing the project then opening it again.
Exiting Eclipse and launch it again.
Uninstalling the old version of the app from the phone before run it again.
For those who may ask about how I use this resource (PNG file), I assign a XML selector file as an ImageButton's drawable. My resource is referenced in that XML file.
Any ideas will be appreciated.
You should change the Modified Date of the file to later. I did it.
Use this http://www.nirsoft.net/utils/filedatech.html
Look through your project's folders for other png files. Many mobile platforms use pngcrush to optimize pngs for mobile, and it is caching them somewhere. When you replaced the file, the IDE didn't notice and hasn't recrushed the new file. The old files will be somewhere in either the workspace's folder, or less likely, Eclipse's application support folders.
Are you on Windows, Mac, or Linux?
Changing an image resource file won't cause Eclipse to build a new version. Try modifying a source file by adding a new line, deleting the line, then saving the file. Eclipse should then rebuild your app when you launch it.
You just need to clean the project before rebuilding it, this removes all previous states and should update resource files if you've changed them in anyway.
Eclipse has a bad habit of compiling all your code to a structure within it's .metadata directory. Not sure if this is the case for your mobile app though.
Try searching the .metadata directory for the original png and modifying/deleting it there. We've had the same issue with deploying to web servers previously and Eclipse not picking up the changes.
I solved it.
The trick was to choose a different name for my image, modify my xml selector file and re-build the project.
Thanks

Categories

Resources