Android Studio 2.1 Cannot resolve symbol 'R'

前端 未结 9 1440
鱼传尺愫
鱼传尺愫 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:59

    Sometimes the R.java class is not created when there is some error into an xml file (like activity_main.xml). For example, if you change some attribute name that has a reserved word that cannot be changed. Like this: if you changed the attribute called: id to another name like
    id_A_Word_With_Error_Here in this code that can be part of the activity_main.xml, your error (R class not created) can occur.

    and there is an error like:

      

    If clean, rebuild did not work and there is no error with import like import com.something... , my suggestion is to search an error into xml files.

提交回复
热议问题