简体   繁体   中英

main cannot be resolved or is not a field, R.layout.main

    package org.example.sudoku;
    import android.app.Activity;
    import android.os.Bundle;
    import org.example.sudoku.R; 

    public class Sudoku extends Activity {
    /** Called when the activity is first created. */
          @Override
          public void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                 setContentView(R.layout.main);
          }
     }

I imported R but still it shows that main cannot be resolved or is not a field

First, delete:

import org.example.sudoku.R; 

Then, in eclipse go to project>clean , choose your project and press OK. Then wait until it is done. The clean operation regenrates R.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM