Android Studio: Gradle: error: cannot find symbol variable

后端 未结 8 561
Happy的楠姐
Happy的楠姐 2020-11-27 20:07

I was working on my app and everything was normal until I tried to display image in java.

I ran the app once and it ran normally, the picture was displayed. After th

8条回答
  •  醉话见心
    2020-11-27 20:33

    You shouldn't be importing android.R. That should be automatically generated and recognized. This question contains a lot of helpful tips if you get some error referring to R after removing the import.

    Some basic steps after removing the import, if those errors appear:

    • Clean your build, then rebuild
    • Make sure there are no errors or typos in your XML files
    • Make sure your resource names consist of [a-z0-9.]. Capitals or symbols are not allowed for some reason.
    • Perform a Gradle sync (via Tools > Android > Sync Project with Gradle Files)

提交回复
热议问题