Android Studio ERROR: Cannot resolve symbol 'View'

This problem can be resolved easily either by pressing alt + enter on the error to import android.view.View or by cross-checking that your method is outside protected void onCreate(Bundle savedInstanceState) and in the class parenthesis.


I am doing the same tutorial and ran into the same problem (that's why I found this question).

I see they explain this issue in the next paragraph named "Build an Intent":

Android Studio will display Cannot resolve symbol errors because this code references classes that are not imported. You can solve some of these with Android Studio's "import class" functionality by pressing Alt + Enter (or Option + Return on Mac). Your imports should end up as the following:

import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText;

  • https://developer.android.com/training/basics/firstapp/starting-activity.html#BuildIntent

I think you forget to include the import statement for View. Add the following import in your code

import android.view.View;