簡體   English   中英

以下類無法實例化:-android.support.design.widget.FloatingActionButton

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

我收到以下錯誤

以下類無法實例化:-android.support.design.widget.FloatingActionButton

最近,每次我在Android Studio中打開新項目時,都會出現此問題,我嘗試了許多在此處編寫的解決方案,例如..

  • 使用gradle選項重建並重新同步項目。
  • 更改Android渲染版本。
  • 檢查更新並安裝最新版本。

這些解決方案都不適合我。

嘗試像這樣更新“ build.gradle(Module.app)”:

...
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'
}
...

並重新同步項目。 它幫助了我

我在res / values / styles.xml中找到了一種更改項目主題的解決方案

<stylename="AppTheme"parent="Theme.AppCompat.Light.DarkActionBar">

而且有效。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM