Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 2.2 Preview 1 Rendering Problems

I'm trying out the new Android Studio 2.2 Preview, and for some reason the layout editor isn't working for layouts that were created in the old version. It keeps telling me various resources aren't found... (Such at the file that I just opened.)

Am I missing something? Is there soemthing I'm unaware of that I should have done when opening an old project?

It seems to be fine when I create a new layout. It's only the previously created layouts and menus that seem to have an issue.

Anyone else experiencing this?

I've tried cleaning, and rebuilding the project.

EDIT

Ok interesting- the problem seems to only happen for layouts that include other layouts. If I remove the include statement it renders fine, but if I add it back, it can't find the included item and gives me an issue. (Even though I can apparently open the included layout itself, and it renders just fine...)

UPDATE

Apparently it only seems to happen with the merge tag. If the layout being included uses the merge tag it won't render and I get the below error. If I remove the merge, and just use another layout tag it seems to work fine.

android.content.res.Resources$NotFoundException: Could not find layout resource matching value 0x7FFF03A2 (resolved name: item_monster_edit) in current configuration.
at android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:913)
at android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:900)
at android.content.res.Resources_Delegate.getLayout(Resources_Delegate.java:437)
at android.content.res.Resources.getLayout(Resources.java:1111)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:136)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:902)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:854)
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.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:397)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:317)
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:549)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:534)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:534)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$41(RenderTask.java:660)
at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:380)
at com.android.tools.idea.rendering.RenderTask.inflate(RenderTask.java:660)
at com.android.tools.idea.uibuilder.model.NlModel.inflate(NlModel.java:321)
at com.android.tools.idea.uibuilder.model.NlModel.render(NlModel.java:378)
at com.android.tools.idea.uibuilder.surface.DesignSurface$3.modelChanged(DesignSurface.java:794)
at com.android.tools.idea.uibuilder.model.NlModel.lambda$notifyListenersModelUpdateComplete$52(NlModel.java:454)
at java.lang.Iterable.forEach(Iterable.java:75)
at com.android.tools.idea.uibuilder.model.NlModel.notifyListenersModelUpdateComplete(NlModel.java:454)
at com.android.tools.idea.uibuilder.model.NlModel.updateModel(NlModel.java:368)
at com.android.tools.idea.uibuilder.model.NlModel$1.run(NlModel.java:231)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:333)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:323)
at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:267)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:282)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:378)
at com.intellij.util.Alarm$Request.run(Alarm.java:389)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.intellij.util.concurrency.SchedulingWrapper$MyScheduledFutureTask.run(SchedulingWrapper.java:227)
at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:187)
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)
like image 334
Jason Stewart Avatar asked May 24 '16 13:05

Jason Stewart


3 Answers

You probably solved this already but I had the same problem with the same error. Always with included layouts.

The solution was to invalidate cache /restart in Android studio. Now it is working and the preview shows the layout with the included layout.

like image 95
alltooconfusingthereforesleep Avatar answered Nov 15 '22 05:11

alltooconfusingthereforesleep


Press Ctrl+Shift+A (Cmd+Shift+A on Mac?) Write "invalidate"

Select "Invalidate Caches / Restart"

like image 43
Sim Avatar answered Nov 15 '22 06:11

Sim


Seems many developers been experiencing this issue. You can star it here 211183

If you cant wait for Tools guys to fix it, switch to older Studio versions. 2.1 should work fine.

Edit: Fixed in Preview 5

like image 1
Nikola Despotoski Avatar answered Nov 15 '22 06:11

Nikola Despotoski