When I try to import a Kotlin Multiplatform Librar...
# multiplatform
j
When I try to import a Kotlin Multiplatform Library as a module in Android Project I am getting this SQLdelight issue: https://github.com/cashapp/sqldelight/issues/1647. Does anyone know the root cause of this issue? Any suggestions on how to fix it would be helpful.
a
Are you trying to use a folder outside your gradle root folder?
Because I don’t think that’s a sqldelight issues, and more of not setting up gradle correctly.
Copy code
root
  shared
    data
    other-shared
  app
  backend
that’s how I would set it up.
j
Are you trying to use a folder outside your gradle root folder? - Yes.
Because I don’t think that’s a sqldelight issues, and more of not setting up gradle correctly. - The issue is happening even with fresh android project and fresh kotlin multiplatform shared library. No modifications done.
a
Yeah, I don’t think you can have a folder outside the root foler.
j
Andrew, having a module folder outside the root directory shouldn't be an issue. As you can see from that issue, using ln -s command and linking the folder solves the issue.
a
yeah the ln -s is a hack to allow the folder to be outside the root directory.
you should probably not do either of those things
j
What’s the reason?
a
Gradle is convention over configuration and the convention is you have a root project and then everything is inside that root project. As that ticket shows you can configure it but you’ll probably get odd behavior if you don’t follow the convention.
Looks like the author of the ticket came to this conclusion as well. https://github.com/cashapp/sqldelight/issues/1647#issuecomment-633680501
Gradle might support the configuration of moving a subproject outside the root directory, I haven’t asked them or anything, but IntellIJ and all the plugins that are included with intellij and gradle plugins may not support that so even if gradle did support it, it wouldn’t surprise me if something else went wrong since this isn’t a standard convention.