3

I am using Android Studio 3.0.1, I have a simple xml file with root ConstraintLayout, so when I do preview and drag and drop an ImageView from the Preview Palette, it is not able to find the new added png file, which I have copy/paste directly in the project directory, not in Android Studio.

enter image description here

I have tried clean, rebuild but it is still not able to find the image.

I know that it will work if I restart it but I think that it is not a good idea to restart each and every time I add a new png file.

Is this a bug in Android Studio?

Have anyone else experienced this?

Nongthonbam Tonthoi
  • 12,667
  • 7
  • 37
  • 64

2 Answers2

1

File - Sync with file system may help. Looking at your file names above, they should be ok as I hit the same problem due to using an upper case char at the start of the filename.

By building the project, I was alerted to this by the following error: "H is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore"

0

Drawable folder host images, so try putting your images in this folder when using imageView.

A workaround for images organization (since the project's folder structure should prevail flat) is using underscore rather that forward dash.