-1

I am a super newbie to Android studio and Java programming. I wrote a super simple code just wanted to test it out on android studio, but the system wont run it and it shows cannot resolve symbol, I have already invalidated and restarted it, but it still shows me that.

MainActivity.java:

package com.example.abc22.acsystem;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

    public class MainActivity extends AppCompatActivity {

        EditText sname, fname, phone;
        TextView txv;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);


            sname = (EditText) findViewById(R.id.firstname);
            fname = (EditText) findViewById(R.id.lastname);
            phone = (EditText) findViewById(R.id.phone);
            txv = (TextView) findViewById(R.id.txv);
        }
        public void onclick(View v){
            txv.setText (sname.getText().toString()+fname.getText()+"number is" + phone.getText());
        }
    }
Kraylog
  • 7,383
  • 1
  • 24
  • 35
  • Please Check you activity_main.xml for errors and build.gradle for missing support library. – S J Dec 21 '17 at 05:59
  • Try Clean Build and then Rebuild Project (under build tab) – martinomburajr Dec 21 '17 at 06:02
  • Elaborate more, please. *Where* is it showing this error? *Read* the error. *Try* to search questions with **same error message**. – Jay Dec 21 '17 at 06:02
  • Check your activity_main.xml and remove errors and then rebuild the project as I can see here there is no import for your R class. – Sabyasachi Dec 21 '17 at 06:03

1 Answers1

0

The problem in your XML file

<?xml version="1.0" encoding="utf-8"?>

this line may duplicate in any of your XML file.