【问题汇总】布局加载器异常的问题
Ubuntu + Android Studio环境,更新Android 4.4W之后,Android Studio的布局加载器发生异常,渲染图形失败。
错误信息如下:
Rendering Problems There are some known bugs in this version of the rendering library. Until a new version is available, use the rendering library from L-preview. Show Exception Click here to install L-preview SDK Platform.
java.lang.NoSuchMethodError: java.lang.System.arraycopy([CI[CII)V at android.text.SpannableStringBuilder.getChars(SpannableStringBuilder.java:916) at android.text.TextUtils.getChars(TextUtils.java:79) at android.text.method.ReplacementTransformationMethod$ReplacementCharSequence.getChars(ReplacementTransformationMethod.java:151) at android.text.TextUtils.getChars(TextUtils.java:79) at android.text.MeasuredText.setPara(MeasuredText.java:106) at android.text.StaticLayout.generate(StaticLayout.java:239) at android.text.DynamicLayout.reflow(DynamicLayout.java:284) at android.text.DynamicLayout.<init>(DynamicLayout.java:170) at android.widget.TextView.makeSingleLayout(TextView.java:6134) at android.widget.TextView.makeNewLayout(TextView.java:6032) at android.widget.TextView.assumeLayout(TextView.java:5933) at android.widget.TextView.onPreDraw(TextView.java:4668) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:847) at android.view.AttachInfo_Accessor.dispatchOnPreDraw(AttachInfo_Accessor.java:46) at com.android.layoutlib.bridge.impl.RenderSessionImpl.render(RenderSessionImpl.java:531) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:339) at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:333) at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:674) at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:663) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932) at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:663) at com.android.tools.idea.rendering.RenderService.render(RenderService.java:790) at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.doRender(AndroidLayoutPreviewToolWindowManager.java:611) at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager.access$1900(AndroidLayoutPreviewToolWindowManager.java:81) at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7$1.run(AndroidLayoutPreviewToolWindowManager.java:553) at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178) at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212) at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171) at org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager$7.run(AndroidLayoutPreviewToolWindowManager.java:548) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310) at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254) at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269) at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227) at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217) at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238) at com.intellij.util.Alarm$Request$1.run(Alarm.java:327) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:662)
经过调研,由于SDK版本与布局加载器不兼容导致的问题。使用低版本的SDK,问题得以解决。