Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android

Bahi Hussien
PLUS
Bahi Hussien
Courses Plus Student 13,128 Points

android studio drawable files doesn't change after replacing.

android studio drawable files doesn't change after replacing. i have tried to clean, rebuild and invalid cache, but nothing worked.

5 Answers

Bahi Hussien
PLUS
Bahi Hussien
Courses Plus Student 13,128 Points

Android Studio drawable files doesn’t change

If you are using android studio and cannot change drawable files although you have replaced them in the res folder, then this post may help you. There different reasons for such problem. First, you may need to rebuild, clean and invalidated cache and restart. Some times android studio doesn’t update project’s paths immediately. to do so

1- go to android studio’s menu bar Build > Rebuild Project

2- go to android studio’s menu bar Build > Clean Project

3- got to android studio’s menu bar File > Invalidate Caches / Restart

Second, if the first solution didn’t work then the problem is caused by the projects configurations. Such error may happen after trying to rename your project, rename your package name or even if you are trying to change project’s location. To fix this problem

1- go to AndroidManifest.xml (app/src/main/AndroidManifest.xml) and be sure that your package name is updated correctly.

2- go to build.gradle (app/build.gradle) and be sure that your application id is updated correctly. If not fix your applications id and Synchronize your project from android studio’s menu File > Synchronize

Phil Spelman
Phil Spelman
6,664 Points

I had manually added folders to the drawable folder. These new folders and files appeared under the Project tab, but would not appear under the Android tab. I did all the suggested steps, and Invalidate and restart worked...AT FIRST...I could navigate to all the folders and images. However, I now had errors in the Design view and after about a minute Android Studio seemed to refresh, and the new files and folders in drawable are no longer visible!!!

At the top left corner of your project tree there is a drop down titled "Android" which means it will not show any "User" (you) added directories. From the drop down change it from "Android" to "Project" and the new drawable directories will appear. Worked for me.

Angus McNab
Angus McNab
2,487 Points

Sorted! Thought I'd have to use the mipmap folders but they're only recommended for icons, I think.

Guilherme Mendonca
Guilherme Mendonca
3,064 Points

Hello Bahi,

Try these steps, it worked for me in the first try.

  1. Close Android Studio
  2. Go to the location where your project is saved (ex.: C:\Users...\Documents\AndroidStudio\FunFacts)
  3. Go all the way until you get to the "res" folder (FunFacts\app\src\main\res)
  4. Unzip the icon file that you downloaded
  5. Enter each drawable folder and replace the old icon with the unziped icon
  6. Open AndroidStudio

Hope it helps!

Bahi Hussien
Bahi Hussien
Courses Plus Student 13,128 Points

Thank you (Guilherme Mendonca) very much for your help.

Harry James
Harry James
14,780 Points

Hello! Try right-clicking on the drawables directory and refreshing it and see if that works.

Also, is it just on previews that you can only see the old images or is it the same when using the app?

Bahi Hussien
Bahi Hussien
Courses Plus Student 13,128 Points

it didn't work on the preview nor on the real device.

Did you try renaming the files and adding them back again?

Bahi Hussien
Bahi Hussien
Courses Plus Student 13,128 Points

Thank you (Gunjeet Hattar) very much for your help.