title: TextInputEditText cannot be cast to TextInputLayout
body: <p>I have this code in my activity</p>
  <pre><code>public class RegisterActivity extends AppCompatActivity {
  
  
  private static final String TAG = RegisterActivity.class.getSimpleName();
  private TextInputLayout mDisplayName;
  private TextInputLayout mEmail;
  private TextInputLayout mPassword;
  private Button mCreateBtn;
  
  private FirebaseAuth mAuth;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_register);
  
      mAuth = FirebaseAuth.getInstance();
  
      mDisplayName = (TextInputLayout)findViewById(R.id.reg_display_name);
      mEmail = (TextInputLayout)findViewById(R.id.reg_email);
      mPassword = (TextInputLayout)findViewById(R.id.reg_password);
      mCreateBtn = (Button) findViewById(R.id.reg_create_btn);
  
      mCreateBtn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              String displayName = mDisplayName.getEditText().getText().toString();
              String email = mEmail.getEditText().getText().toString();
              String password = mPassword.getEditText().getText().toString();
  
              registerUser(displayName,email,password);
  
          }
  
  
      });
  }
  
  private void registerUser(String displayName, String email, String password) {
  
     mAuth.signInWithEmailAndPassword(email,password)
             .addOnCompleteListener(this, new OnCompleteListener&lt;AuthResult&gt;() {
                 @Override
                 public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                       if(task.isSuccessful()){
                           Intent mainIntent = new Intent(RegisterActivity.this,MainActivity.class);
                           startActivity(mainIntent);
                           finish();
                       }else{
                           Toast.makeText(RegisterActivity.this,&quot;You got some error.&quot;,Toast.LENGTH_SHORT).show();
                       }
                 }
             });
  
  }
  
  
  }
  </code></pre>
  <p>Its corresponding XML code is:</p>
  <pre><code>&lt;android.support.constraint.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      tools:context=&quot;.RegisterActivity&quot;&gt;
      
      &lt;android.support.design.widget.TextInputLayout
          android:id=&quot;@+id/textInputLayout2&quot;
          android:layout_width=&quot;368dp&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginStart=&quot;8dp&quot;
          android:layout_marginTop=&quot;8dp&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;&gt;
          
          &lt;android.support.design.widget.TextInputEditText
              android:id=&quot;@+id/reg_display_name&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:hint=&quot;hint&quot;
              android:text=&quot;Display name&quot; /&gt;
      &lt;/android.support.design.widget.TextInputLayout&gt;
      
      &lt;android.support.design.widget.TextInputLayout
          android:id=&quot;@+id/textInputLayout3&quot;
          android:layout_width=&quot;368dp&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginStart=&quot;8dp&quot;
          android:layout_marginTop=&quot;8dp&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toBottomOf=&quot;@+id/textInputLayout2&quot;&gt;
  
          &lt;android.support.design.widget.TextInputEditText
              android:id=&quot;@+id/reg_email&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:hint=&quot;hint&quot;
              android:text=&quot;Email&quot; /&gt;
      &lt;/android.support.design.widget.TextInputLayout&gt;
      
      &lt;android.support.design.widget.TextInputLayout
          android:id=&quot;@+id/textInputLayout4&quot;
          android:layout_width=&quot;368dp&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginStart=&quot;8dp&quot;
          android:layout_marginTop=&quot;8dp&quot;
          app:layout_constraintStart_toStartOf=&quot;parent&quot;
          app:layout_constraintTop_toBottomOf=&quot;@+id/textInputLayout3&quot;&gt;
      
          &lt;android.support.design.widget.TextInputEditText
              android:id=&quot;@+id/reg_password&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:hint=&quot;hint&quot;
              android:text=&quot;Password&quot; /&gt;
      &lt;/android.support.design.widget.TextInputLayout&gt;
  
      &lt;Button
          android:id=&quot;@+id/reg_create_btn&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginTop=&quot;8dp&quot;
          android:text=&quot;Create account&quot;
          android:textAllCaps=&quot;false&quot;
          app:layout_constraintTop_toBottomOf=&quot;@+id/textInputLayout4&quot;
          tools:layout_editor_absoluteX=&quot;255dp&quot; /&gt;
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  <p>When I run the app though I get this message:</p>
  <pre><code>Caused by: java.lang.ClassCastException: android.support.design.widget.TextInputEditText cannot be cast to android.support.design.widget.TextInputLayout
  </code></pre>
  <p>I am also giving you the gradle file just in case there is something wrong with the design version.</p>
  <pre><code> apply plugin: 'com.android.application'
  
   android {
   compileSdkVersion 27
   defaultConfig {
      applicationId &quot;theo.tziomakas.lapitchat&quot;
      minSdkVersion 21
      targetSdkVersion 27
      versionCode 1
      versionName &quot;1.0&quot;
      testInstrumentationRunner 
      &quot;android.support.test.runner.AndroidJUnitRunner&quot;
    }
     buildTypes {
      release {
          minifyEnabled false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
     }
  }
  
  dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.android.support:appcompat-v7:27.1.1'
  implementation 'com.android.support:design:27.1.1'
  implementation 'com.android.support.constraint:constraint- 
  layout:1.1.0'
  implementation 'com.google.firebase:firebase-auth:11.6.0'
  testImplementation 'junit:junit:4.12'
  androidTestImplementation 'com.android.support.test:runner:1.0.2'
  androidTestImplementation 
  'com.android.support.test.espresso:espresso-core:3.0.2'
   }
  
   apply plugin: 'com.google.gms.google-services'
  </code></pre>
  <p>So any ideas how to fix that exception?</p>
  <p>Thanks
  Theo.</p>