theone1one
theone1one

Reputation: 1520

The following classes could not be found: - android.support.design.widget.TextInputLayout

I am Learning tutorial for Android Floating Label Edit Text but I get error as shown in the Image. Please help me out from this

This is Tutorial which i am following.

Please help me out from this error. Rebuild is not solving the problem.

Upvotes: 16

Views: 31674

Answers (3)

Manthan_Admane
Manthan_Admane

Reputation: 449

First things first : If you are using the lastest sdk28 TextInputLayout is having some bug. At least mine did (date: 22 Sept 2018 ) NOT work.

To make it work the best way is to use slightly lower SDK for you target and compile SDK version. (I used sdk 27 and everything worked out fine then.)

To use TextInputLayout and then its features such as "floatinghinttext" you need to update your build.gradle(module.app) found in gradleScripts.

in dependencies add- implementation 'com.android.support:design:25.0.0'

(if you get some error it must be of some latest version available, so use that instead of 25.0.0)

Note: The "compile" keyword is getting replaced by "implementation" for newer/all versions.

I am fairly new to android development, suggestions are welcomed. Please excuse if any mistakes committed.

Upvotes: 2

tony gil
tony gil

Reputation: 9554

You must include support libraries (like the ones below), yet this is sometimes not sufficient.

compile ("com.android.support:support-v4:23.3.0")
compile ("com.android.support:appcompat-v7:23.3.0")
compile ("com.android.support:support-annotations:23.3.0")
compile ("com.android.support:recyclerview-v7:23.3.0")
compile ("com.android.support:design:23.3.0")

Examine your layout in design view, and click on Show Exception

layout design view

This answer will help if you have the following problem:

You need to use a Theme.AppCompat theme (or descendant) with the design library.

In your Manifest file, include in your application declaration

android:theme="@style/Theme.AppCompat"

Rebuild and your problem should be solved.

Upvotes: 7

leb1755
leb1755

Reputation: 1424

Does your build.gradle file contain the line below?

compile 'com.android.support:design:22.2.0'

Upvotes: 31

Related Questions