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.
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?
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 az, 0-9, or underscore"
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.