https://kotlinlang.org logo
#compose
Title
# compose
b

Brett Best

07/28/2020, 3:03 PM
My Android Studio Kotlin plugin updated however now I’m getting errors for all my Compose code saying it was compiled using a pre-released version of Kotlin. Perhaps related to https://kotlinlang.slack.com/archives/CJLTWPH7S/p1595908172474900 🤔
z

Zach Klippenstein (he/him) [MOD]

07/28/2020, 3:13 PM
Yes, i think dev16 should support the RC, and those errors will go away then.
f

Fudge

07/28/2020, 3:14 PM
just changing the kotlin version in the buildscript seems to have fixed it
b

Brett Best

07/28/2020, 3:15 PM
I tried changing it haha, what version did you use @Fudge?
f

Fudge

07/28/2020, 3:15 PM
ext.kotlin_version = "1.4.0-rc"
b

Brett Best

07/28/2020, 3:16 PM
Oh 🤦🏻 I tried that but with capital RC 😕
@Fudge did doing that make your previews not work?
f

Fudge

07/28/2020, 5:57 PM
it seems they don't work in dev 15
s

Sinan Kozak

07/28/2020, 7:28 PM
So preview doesnt workin with dev15, right? Or am I missing something?
v

Val Salamakha

07/29/2020, 12:57 AM
@Sinan Kozak, you are right. Preview doesn’t work ( 1.4.0-rc & dev15)
b

Brett Best

07/29/2020, 4:22 AM
I just got a Android Studio 4.2 Canary 6 update, they seem to be working again
🙌 3
s

Sinan Kozak

07/29/2020, 6:39 AM
I can verify the same thing. Thank you for the tip
p

Pete Doyle

07/31/2020, 6:23 PM
Having trouble with preview on 1.4.0-rc, dev15, AGP 4.2.0-canary7, AS 4.2 Canary 7. Anyone seen this in the preview tab’s errors section (pops up when clicking the red exclamation point icon)?
Copy code
The following classes could not be instantiated:
- androidx.ui.tooling.preview.ComposeViewAdapter (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE.  If this is an unexpected error you can also try to build the project, then manually refresh the layout.  Exception Details:


java.lang.NoClassDefFoundError: Could not initialize class androidx.compose.FrameManager
	at androidx.ui.core.WrapperKt.setContent(Wrapper.kt:180)
	at androidx.ui.core.WrapperKt.setContent$default(Wrapper.kt:175)
	at androidx.ui.tooling.preview.ComposeViewAdapter.init$ui_tooling_release(ComposeViewAdapter.kt:297)
	at androidx.ui.tooling.preview.ComposeViewAdapter.init(ComposeViewAdapter.kt:366)
	at androidx.ui.tooling.preview.ComposeViewAdapter.<init>(ComposeViewAdapter.kt:149)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:399)
	at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:189)
	at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:147)
	at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:303)
	at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:417)
	at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:428)
	at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:332)
	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:657)
	at android.view.LayoutInflater.inflate(LayoutInflater.java:499)
	at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:347)
	at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:435)
	at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:141)
	at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:705)
	at com.android.tools.idea.rendering.RenderTask.lambda$inflate$6(RenderTask.java:860)
	at com.android.tools.idea.rendering.RenderExecutor$runAsyncActionWithTimeout$2.run(RenderExecutor.kt:170)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
b

Brett Best

07/31/2020, 6:30 PM
@Pete Doyle what version of kotlin is in your build.gradle files?
p

Pete Doyle

07/31/2020, 6:33 PM
Best I can tell, it’s 1.4.0-rc