【Android studio】Rendering Problems:classes could not be instantiated 解決方法

Rendering Problems

The following classes could not be instantiated

android.support.v7.internal.widget.ActionBarOverlayLayout (Open Class, Show Exception, Clear Cache)

Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details java.lang.NoClassDefFoundError: Could not initialize class android.support.v7.internal.widget.ActionBarOverlayLayout   at java.lang.reflect.Constructor.newInstance  at android.view.LayoutInflater.inflate(LayoutInflater.java:482)   at android.view.LayoutInflater.inflate(LayoutInflater.java:414)   at com.android.layoutlib.bridge.bars.BridgeActionBar.<init>(BridgeActionBar.java:84)   at com.android.layoutlib.bridge.bars.AppCompatActionBar.<init>(AppCompatActionBar.java:56)


解決辦法:

將styles.xml  中的

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

修改爲:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
在theme前面加上了一個base,即可解決!
發佈了12 篇原創文章 · 獲贊 7 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章