Red*_*ne1 91 android android-studio
更新BuildTools
到版本25.0.0后.
compileSdkVersion 25
buildToolsVersion "25"
Run Code Online (Sandbox Code Playgroud)
我有Android布局预览的问题.现在它显示错误:
渲染期间引发异常:无法找到模式0
我试图清理和重建项目,但它不起作用.在更新之前一切都很好.
我知道我可以回到之前的版本BuildTools
,但我想知道为什么它不适用于版本25.0.0
?
好像这是一个问题 RecyclerView
java.lang.IllegalStateException: Unable to locate mode 0
at android.view.DisplayInfo.findMode(DisplayInfo.java:458)
at android.view.DisplayInfo.getMode(DisplayInfo.java:445)
at android.view.Display.getRefreshRate(Display.java:648)
at android.support.v7.widget.RecyclerView.onAttachedToWindow(RecyclerView.java:2392)
at android.view.View.dispatchAttachedToWindow(View.java:15392)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2953)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:333)
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)
Run Code Online (Sandbox Code Playgroud)
Fur*_*qan 111
此问题已得到解决,请更新支持库
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
Run Code Online (Sandbox Code Playgroud)
Xco*_*OOB 62
这是版本25的恼人的bug.临时解决方案是降级你的项目,
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
Run Code Online (Sandbox Code Playgroud)
Hib*_*bem 18
另一个临时解决方案是替换为<android.support.v7.widget.RecyclerView
,<RecyclerView
因此您可以看到渲染的视图.编译时,将其更改回<android.support.v7.widget.RecyclerView
Android支持库提供向后兼容的实用程序功能.应用程序可以使用这些实用程序功能在各种Android系统版本中提供适当的用户体验.
您应该降级临时解决方案的版本.
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:v7:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
Run Code Online (Sandbox Code Playgroud)
要查看预览,我使用此技巧..... app:layoutManager="0"
在布局XML中添加 recyclelerView
但它会在运行时抛出InflateException.因此,在运行应用程序之前,请从XML布局文件中删除此属性!
归档时间: |
|
查看次数: |
19552 次 |
最近记录: |