main cannot be resolved or is not a field

前端 未结 9 1316
盖世英雄少女心
盖世英雄少女心 2020-12-07 20:44

This error occurs in setContentView line in this code snippet:

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedI         


        
相关标签:
9条回答
  • Delete all your import statements from the class where you are getting this error message.

    Then press ctrl+shift+o

    0 讨论(0)
  • 2020-12-07 21:37

    I have removed the following line and it worked for me.

    import android.R;

    0 讨论(0)
  • 2020-12-07 21:37

    I changed

       import android.R;
    

    to

     import your.application.packagename.R;
    

    And project ->clean still the error.

    But when I Run the project the error automatically gone, may be Eclipse problem.

    0 讨论(0)
提交回复
热议问题