https://kotlinlang.org logo
Title
j

jimmyt

09/24/2021, 8:57 PM
Hello everybody, I've just created a new Compose Desktop project and added dependencies on the SQLDelight gradle plugin and sqlite driver, both version 1.5.1. Now when I run the main function in Main.kt, I get the following error:
Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: 'kotlinx.coroutines.JobSupport kotlinx.coroutines.ChildHandleNode.getJob()'
	at kotlinx.coroutines.JobImpl.handlesException(JobSupport.kt:1333)
	at kotlinx.coroutines.JobImpl.<init>(JobSupport.kt:1326)
	at kotlinx.coroutines.JobKt__JobKt.Job(Job.kt:389)
	at kotlinx.coroutines.JobKt.Job(Unknown Source)
	at androidx.compose.runtime.Recomposer.<init>(Recomposer.kt:130)
	at androidx.compose.ui.platform.DesktopOwners.<init>(DesktopOwners.desktop.kt:78)
	at androidx.compose.desktop.ComposeLayer.<init>(ComposeLayer.desktop.kt:63)
	at androidx.compose.desktop.ComposeWindow.<init>(ComposeWindow.desktop.kt:35)
	at androidx.compose.desktop.AppWindow.<init>(AppWindow.desktop.kt:116)
	at androidx.compose.desktop.AppWindow.<init>(AppWindow.desktop.kt)
	at androidx.compose.desktop.AppWindow_desktopKt$Window$1.run(AppWindow.desktop.kt:85)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Process finished with exit code 0
I've posted the entire project on Github here. Does anyone know what might be causing this issue?
🧵 1
m

Mitchell Syer

09/24/2021, 10:15 PM
You implemented the gradle plugin in the dependencies block
implementation("com.squareup.sqldelight:gradle-plugin:1.5.1")
. Remove that and you should be good.
j

jimmyt

09/25/2021, 12:57 AM
Thanks; that fixed it. Do you have any idea why the SQLDelight gradle plugin causes this issue?
m

Mitchell Syer

09/25/2021, 1:16 AM
Because you are not supposed to implement it that way, you already implemented it at the top of the gradle file in the plugins block
j

jimmyt

09/25/2021, 2:20 AM
Ah, ok. I'm new to SQLDelight, so please excuse me if this is a foolish question, but I see in the documentation that they include the gradle plugin as a class path dependency in the buildscript block, and then use
apply plugin:
outside of the buildscript block. Does implementing it in the plugins block, as I have done, do both of those in a single statement?
m

Mitchell Syer

09/25/2021, 2:23 AM
Yep, the Plugins block is the newer version of the BuildScript block
j

jimmyt

09/27/2021, 4:44 PM
Got it. Thanks for taking the time to help me out.