Luigi04 Luigi04 - 1 year ago 114
Android Question

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!

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download