Anyone else seeing this error in their Compose Pre...
# android-studio
j
Anyone else seeing this error in their Compose Previews? Full stacktrace in đź§µ
đź‘€ 1
Copy code
Property access not allowed during rendering
	at com.android.tools.idea.rendering.RenderSecurityException.create(RenderSecurityException.java:52)
	at com.android.tools.idea.rendering.RenderSecurityManager.checkPropertiesAccess(RenderSecurityManager.java:327)
	at java.base/java.lang.System.getProperties(System.java:718)
	at com.intellij.idea.IdeaLogger.logErrorHeader(IdeaLogger.java:110)
	at com.intellij.idea.IdeaLogger.error(IdeaLogger.java:104)
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:187)
	at com.intellij.ide.plugins.StartupAbortedException.processException(StartupAbortedException.java:30)
	at com.intellij.ide.plugins.MainRunner$1.uncaughtException(MainRunner.java:35)
	at _layoutlib_._internal_.kotlinx.coroutines.CoroutineExceptionHandlerImplKt.handleCoroutineExceptionImpl(CoroutineExceptionHandlerImpl.kt:45)
	at _layoutlib_._internal_.kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:39)
	at _layoutlib_._internal_.kotlinx.coroutines.StandaloneCoroutine.handleJobException(Builders.common.kt:192)
	at _layoutlib_._internal_.kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:229)
	at _layoutlib_._internal_.kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:906)
	at _layoutlib_._internal_.kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:863)
	at _layoutlib_._internal_.kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:828)
	at _layoutlib_._internal_.kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100)
	at _layoutlib_._internal_.kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:193)
	at _layoutlib_._internal_.kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
	at _layoutlib_._internal_.kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
	at _layoutlib_._internal_.kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:56)
	at _layoutlib_._internal_.kotlinx.coroutines.BuildersKt.launch(Unknown Source)
	at _layoutlib_._internal_.kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:47)
	at _layoutlib_._internal_.kotlinx.coroutines.BuildersKt.launch$default(Unknown Source)
	at androidx.compose.ui.platform.WindowRecomposer_androidKt$createLifecycleAwareWindowRecomposer$2.onStateChanged(WindowRecomposer.android.kt:375)
	at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
	at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.java:196)
	at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer(WindowRecomposer.android.kt:364)
	at androidx.compose.ui.platform.WindowRecomposer_androidKt.createLifecycleAwareWindowRecomposer$default(WindowRecomposer.android.kt:322)
	at androidx.compose.ui.platform.WindowRecomposerFactory$Companion$LifecycleAware$1.createRecomposer(WindowRecomposer.android.kt:166)
	at androidx.compose.ui.platform.WindowRecomposerPolicy.createAndInstallWindowRecomposer$ui_release(WindowRecomposer.android.kt:222)
	at androidx.compose.ui.platform.WindowRecomposer_androidKt.getWindowRecomposer(WindowRecomposer.android.kt:297)
	at androidx.compose.ui.platform.AbstractComposeView.resolveParentCompositionContext(ComposeView.android.kt:244)
	at androidx.compose.ui.platform.AbstractComposeView.ensureCompositionCreated(ComposeView.android.kt:251)
	at androidx.compose.ui.platform.AbstractComposeView.onAttachedToWindow(ComposeView.android.kt:283)
	at android.view.View.dispatchAttachedToWindow(View.java:20753)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3490)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
	at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:57)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:368)
	at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:436)
	at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:121)
	at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:736)
	at com.android.tools.idea.rendering.RenderTask.lambda$inflate$7(RenderTask.java:892)
	at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$2.run(RenderExecutor.kt:187)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Selecting the option to turn off custom view rendering sandbox resolves this, but I haven’t had this issue since I started with Compose in October and it all of a sudden started this week. I’m curious what is causing it and what the implications of turning off the “custom view rending sandbox” are.
Android Studio Version Info
Copy code
Android Studio Bumblebee | 2021.1.1 Patch 2
Build #AI-211.7628.21.2111.8193401, built on February 17, 2022
Runtime version: 11.0.11+0-b60-7590822 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.6.5
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Registry: external.system.auto.import.disabled=true, ide.instant.shutdown=false
Non-Bundled Plugins: com.dubreuia (2.2.0), com.intellij.javafx (1.0.4), org.jetbrains.kotlin (211-1.6.10-release-923-AS7442.40), com.intellij.lang.jsgraphql (3.1.2), org.intellij.plugins.markdown (211.7142.37), <http://com.jetbrains.edu|com.jetbrains.edu> (2022.1-2021.1-1326)
a
Have you updated your Compose version lately?
To give you more context, a recent change in compose (https://android-review.googlesource.com/c/platform/frameworks/support/+/1989451) caused layoutlib to fail. We didn't realize it until a few days after the compose version containing this change was released. A fixed was made recently (https://android-review.googlesource.com/c/platform/frameworks/support/+/2046524) but it will only be available when the next compose version is released (1.2.0-alpha07 IIRC).
🙏 1
that explains why you were not seeing any issues and now you are
The rendering sandbox error happens because we use IntelliJ logger (
IdeaLogger
) to report issues in layoutlib, and it makes calls unsupported by our
SecurityManager
, e.g.
System.getProperties()
. We also made a change in Android Studio Dolphin that will make
IdeaLogger
an exception, so you won't need to disable the rendering sandbox when hitting a render error.
let me know if you have any questions about it
j
We upgraded from alpha04 to alpha05 right before this so that checks out.
Thanks for the response!
Following up to confirm that alpha07 resolved this issue for my project
🙏 1
a
thanks for confirming!