Android Build a Simple Android App with Java Basic Android Programming Making a Button Do Something

I am having an error message every time I try to test the click button function

Error:Execution failed for task ':app:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details. Error:(20, 52) error: cannot find symbol variable factTextView

i have tried using Alt + Enter method. But is not working.

Pliz help

2 Answers

Charles Wanjohi
Charles Wanjohi
7,668 Points

Do you have a variable named factTextView in your code? Note the spelling should be exact e.g facttextView or facttextview is completely different.You should have shared your code for a better help

I didn't manage to upload the screen shot

I seem to be having the same problem. When I press alt+enter I'm not given the option to cast, how is this happening?

public class FunFactsActivity extends AppCompatActivity {
    // Declare our view variables
    private TextView factTextView;
    private Button showFactButton;

    protected void onCreate(Bundle savedInstanceState) {

        // Assign the Views from the layout file to the corresponding variables
        factTextView = findViewById(;