Android Studio: Gradle: error: cannot find symbol variable -


i working on app , normal until tried display image in java.

i ran app once , ran normally, picture displayed. after asked me import libraries , imported them. after got errors activities.

errors like:

gradle: error: cannot find symbol variable activity_main gradle: error: cannot find symbol variable button1 gradle: error: cannot find symbol variable button2 gradle: error: cannot find symbol variable textview gradle: error: cannot find symbol variable secondactivity 

in mainactivity have imported these libraries:

import android.r; import android.content.intent; import android.os.bundle; import android.app.activity; import android.view.menu; import android.widget.button; 

and in secondactivity these:

import android.r; import android.app.activity; import android.os.bundle; import android.view.view; import android.widget.button; 

does know how fix this?

edit: deleted import android.r; , works normally.

you shouldn't importing android.r. should automatically generated , recognized. this question contains lot of helpful tips if error referring r after removing import.

some basic steps after removing import, if errors appear:

  • clean build, rebuild
  • make sure there no errors or typos in xml files
  • make sure resource names consist of [a-z0-9.]. capitals or symbols not allowed reason.
  • perform gradle sync (via tools > android > sync project gradle files)

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -