android studio 预览报错,Android Studio预览layout文件报错
报错信息如下:java.lang.NullPointerExceptionat android.content.res.Resources_Delegate.getValue(Resources_Delegate.java:747)at android.content.res.Resources.getValue(Resources.java:1286)at android.support.v4.
报错信息如下:
java.lang.NullPointerException
at android.content.res.Resources_Delegate.getValue(Resources_Delegate.java:747)
at android.content.res.Resources.getValue(Resources.java:1286)
at android.support.v4.content.res.ResourcesCompat.loadFont(ResourcesCompat.java:335)
at android.support.v4.content.res.ResourcesCompat.getFont(ResourcesCompat.java:314)
at android.support.v7.widget.TintTypedArray.getFont(TintTypedArray.java:118)
at android.support.v7.widget.AppCompatTextHelper.updateTypefaceAndStyle(AppCompatTextHelper.java:234)
at android.support.v7.widget.AppCompatTextHelper.loadFromAttributes(AppCompatTextHelper.java:165)
at android.support.v7.widget.AppCompatTextHelperV17.loadFromAttributes(AppCompatTextHelperV17.java:38)
at android.support.v7.widget.AppCompatTextView.(AppCompatTextView.java:82)
at android.support.v7.widget.AppCompatTextView.(AppCompatTextView.java:72)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:465)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:160)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:150)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadClass(LayoutlibCallbackImpl.java:193)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:333)
at android.view.BridgeInflater.onCreateView(BridgeInflater.java:152)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:222)
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.inflate(LayoutInflater.java:492)
at com.android.layoutlib.bridge.bars.CustomBar.(CustomBar.java:95)
at com.android.layoutlib.bridge.bars.StatusBar.(StatusBar.java:67)
at com.android.layoutlib.bridge.impl.Layout.createStatusBar(Layout.java:221)
at com.android.layoutlib.bridge.impl.Layout.(Layout.java:143)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:301)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$53(RenderTask.java:659)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
解决: 替换 styles.xml 中Theme.AppCompat.Light.DarkActionBar 为 Base.Theme.AppCompat.Light.DarkActionBar
更多推荐
所有评论(0)