The following classes could not be instantiated: - android.support.design.widget.FloatingActionButton

一曲冷凌霜 提交于 2019-12-13 05:38:17

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!