error: cannot find symbol variable EXTRA_MESSAGE in Android Studio

  • Replies:4
sameer
  • Forum posts: 1

Dec 26, 2014, 2:23:14 PM via Website

I was following 'Building Your First App' tutorial in developer.android.com

to create an edit text button for reading a text and then displaying that text in another activity, i used the exact code they provided there in my android studio project, but i'm getting 2 errors in MyActivity.java and DisplayMessageActivity.java, one error each for these java files.

error: cannot find symbol variable EXTRA_MESSAGE, why this error, pls help me to solve this.

Reply
Vipin P R
  • Forum posts: 1

Aug 15, 2016, 3:22:41 PM via Website

include this in your main activity class
public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";

ShanJon BartlowAbdullateef IsholaJúlio Gadioli SoaresStalag

Reply
Ray Lier
  • Forum posts: 1

Oct 3, 2016, 1:01:19 AM via Website

It's already there. I had the same issue. In the item 'Build an Intent' it's included. Not in the previous step. That's the problem with the copy and paste thing. Part of the learning proces ;-)

Reply
eldo raman
  • Forum posts: 1

Apr 26, 2017, 9:05:52 AM via Website

The general causes for a Cannot find symbol error are things like:

  • Incorrect spelling.
  • Wrong case. Halo is different from halo.
  • Improper use of acceptable identifier values (letters, numbers,
    underscore, dollar sign), my-class is not the same as myclass.
  • No variable declaration or variable is outside of the scope you are
    referencing it in.

Eldo

Reply
Michael Renzo Herrera Valdez
  • Forum posts: 1

Aug 21, 2017, 5:59:06 AM via Website

hola disculpa mi ignorancia no entiendo, cual es el problema de copiar y pegar?

Reply