The following classes could not be found: - androi

2020-08-09 09:47发布

问题:

This is Tutorial which i am following.

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

回答1:

Does your build.gradle file contain the line below?

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


回答2:

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

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.



回答3:

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.