问题
I receive the following error
The following classes could not be instantiated: - android.support.design.widget.FloatingActionButton
Lately that problem appears every time I opened new project in Android Studio, I tried many solutions written here, like ..
- Rebuild and re-sync project with gradle option.
- Change Android rendering version.
- Checking updates and install latest version.
None of those solutions work for me.
回答1:
Try update "build.gradle (Module.app)" like this:
...
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-annotations:23.2.1'
compile 'com.android.support:design:23.2.1'
}
...
and resync project. It helped me
回答2:
I found a solution which is changing project theme in res/values/styles.xml
<stylename="AppTheme"parent="Theme.AppCompat.Light.DarkActionBar">
and it worked.
来源:https://stackoverflow.com/questions/35924773/the-following-classes-could-not-be-instantiated-android-support-design-widget