Android Studio 2.1 Cannot resolve symbol 'R'

前端 未结 9 1208
鱼传尺愫
鱼传尺愫 2021-02-10 17:10

Android Studio 2.1, Java V8 Update 91, Gradle 2.1.0 .

I know that this questions has been asked many times here, but none of the recommendation solutions works out.

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-10 17:44

    I've seen this problem many times. The right solution is:

    When you type R, the Android Studio will give you many different namespaces for R to choose from, that look like R(***.***.***), but what you really need is the namespace that ends with ***.myProject. (Note: myProject is your project name), e.g: R(com.example.milka.demoProject).

    If you choose any other namespace, you will get the error message, so you have to delete the unneeded import, and re-choose your R

提交回复
热议问题