我有各种使用DatePicker
的布局,布局编辑器突然停止工作,显示渲染错误。
如果我关闭自定义视图渲染沙箱,则会正确呈现布局;然而,由于我没有改变任何东西,因此不清楚这个问题的原因,在错误之前我不需要关闭渲染沙箱。
完整的错误堆栈:
Exception raised
during rendering
:
Write access
not allowed
at com(user.timezone)
at com
.android.ide.common.rendering.RenderSecurityException.create(RenderSecurityException.java:52)
at java
.android.ide.common.rendering.RenderSecurityManager.checkPermission(RenderSecurityManager.java:616)
at com
.util.TimeZone.setDefault(TimeZone.java:713)
at libcore
.ibm.icu.util.TimeZone.setDefault(TimeZone.java:973)
at libcore
.icu.DateIntervalFormat_Delegate.createDateIntervalFormat(DateIntervalFormat_Delegate.java:61)
at libcore
.icu.DateIntervalFormat.createDateIntervalFormat(DateIntervalFormat.java:-1)
at libcore
.icu.DateIntervalFormat.getFormatter(DateIntervalFormat.java:112)
at libcore
.icu.DateIntervalFormat.formatDateRange(DateIntervalFormat.java:102)
at android
.icu.DateIntervalFormat.formatDateRange(DateIntervalFormat.java:71)
at android
.text.format.DateUtils.formatDateRange(DateUtils.java:826)
at android
.text.format.DateUtils.formatDateRange(DateUtils.java:651)
at android
.text.format.DateUtils.formatDateRange(DateUtils.java:628)
at android
.widget.CalendarView.setMonthDisplayed(CalendarView.java:1258)
at android
.widget.CalendarView.goTo(CalendarView.java:1131)
at android
.widget.CalendarView.<init>(CalendarView.java:414)
at java
.widget.CalendarView.<init>(CalendarView.java:333)
at android
.lang.reflect.Constructor.newInstance(Constructor.java:408)
at android
.view.LayoutInflater.createView(LayoutInflater.java:594)
at android
.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
at android
.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
at android
.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android
.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android
.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android
.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android
.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android
.widget.DatePicker.<init>(DatePicker.java:175)
at java
.widget.DatePicker.<init>(DatePicker.java:149)
at android
.lang.reflect.Constructor.newInstance(Constructor.java:408)
at android
.view.LayoutInflater.createView(LayoutInflater.java:594)
at android
.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
at android
.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
at android
.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755)
at android
.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android
.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android
.view.LayoutInflater.rInflate_Original(LayoutInflater.java:758)
at android
.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android
.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android
.view.LayoutInflater.rInflate_Original(LayoutInflater.java:758)
at android
.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android
.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android
.view.LayoutInflater.rInflate_Original(LayoutInflater.java:758)
at android
.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android
.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android
.view.LayoutInflater.rInflate_Original(LayoutInflater.java:758)
at android
.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android
.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android
.view.LayoutInflater.rInflate_Original(LayoutInflater.java:758)
at android
.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android
.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android
.view.LayoutInflater.inflate(LayoutInflater.java:492)
Copy stack
during rend
.view.LayoutInflater.inflate(LayoutInflater.java:373)
to clipboardering(user.timezone)Turn off custom view rendering sandbox Write access not allowed during rendering
答案 0 :(得分:1)
这是一个错误Android Studio由于某些未知原因未加载在“java.io.tmpdir”中绘制布局所需的临时文件,此问题列在此处:Android Issue:63279建议的修复方法是将SDK更新到最新版本(如果尚未更新),并通过“帮助&gt;检查更新”应用最新的Android Studio补丁。
编辑:
我发现这有用:Adroid Pickers UI Reference,在实现日期选择器后,如此处所述错误消失了......
答案 1 :(得分:0)
我不确定它是否对您有用,但我使用的是Intellij IDEA,我通过在idea.properties文件中添加以下行来解决此问题。
android.render.sandbox=false
idea.properties位于/ bin /