简体   繁体   中英

android app test error

When I run my first app, I got error.

Code of the activity:

package com.pradeep.ulc;

import android.app.Activity;
import android.os.Bundle;

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

Error:

R cannot be resolved to a variable New1Activity.java /new1/src/com/pradeep/ulc line 11 Java Problem

How can I fix it?

1) Make sure the package name is correctly set everywhere

2) Try doing a clean build to regenerate R.java.

If you must use a different package, import the R.java from the package specified in the manifest.

It means that you have problem in your resources, so R file cannot be generated.
What do you have in res/layout/main.xml file?

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