AndroidStudio无法预览布局文件问题的解决

今天写个小demo,IDE不知道哪里抽抽了,编写布局时不能预览,报如下错误:


Rendering Problems The following classes could not be instantiated:- android.support.v7.widget.Toolbar (Open Class, Show Exception, Clear Cache)- android.support.v7.app.WindowDecorActionBar (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.NoSuchMethodError: android.graphics.drawable.VectorDrawable_Delegate.nCreateTreeFromCopy(JJ)J   at android.graphics.drawable.VectorDrawable.nCreateTreeFromCopy(VectorDrawable.java:-1)   at android.graphics.drawable.VectorDrawable.access$400(VectorDrawable.java:204)   at android.graphics.drawable.VectorDrawable$VectorDrawableState.createNativeTreeFromCopy(VectorDrawable.java:837)   at android.graphics.drawable.VectorDrawable$VectorDrawableState.(VectorDrawable.java:812)   at android.graphics.drawable.VectorDrawable.mutate(VectorDrawable.java:268)   at android.support.v7.widget.TintManager.getDrawable(TintManager.java:180)   at android.support.v7.widget.TintManager.getDrawable(TintManager.java:168)   at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:62)   at android.support.v7.widget.Toolbar.(Toolbar.java:257)   at android.support.v7.widget.Toolbar.(Toolbar.java:199)   at java.lang.reflect.Constructor.newInstance(Constructor.java:422)   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)   at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)   at android.view.LayoutInflater.inflate(LayoutInflater.java:518)   at android.view.LayoutInflater.inflate(LayoutInflater.java:426)   at com.android.layoutlib.bridge.bars.BridgeActionBar.(BridgeActionBar.java:84)   at com.android.layoutlib.bridge.bars.AppCompatActionBar.(AppCompatActionBar.java:59)   at com.android.layoutlib.bridge.impl.Layout.createActionBar(Layout.java:240)   at com.android.layoutlib.bridge.impl.Layout.(Layout.java:152) Copy stack to clipboard Failed to load AppCompat ActionBar with unknown error. (2 similar errors not shown)



一通百度,虽然不知道具体为什么,但是问题还是解决了:

在Theme.AppCompat.Light.DarkActionBar前面加上Base.  如下




你可能感兴趣的:(成长)