Skip to content

Compose Multiplatform #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
moshezvili opened this issue Mar 28, 2023 · 4 comments
Closed

Compose Multiplatform #444

moshezvili opened this issue Mar 28, 2023 · 4 comments

Comments

@moshezvili
Copy link

Hi , im trying to use Compose Multiplatform and setting vscode.
I'm getting Unresolved reference: androidxkotlin(UNRESOLVED_REFERENCE) for all of my dependencies.

this is my Gradle:

plugins {
// Apply the application plugin to add support for building a CLI application in Java.
application
kotlin("jvm") version "1.8.0"
id("org.jetbrains.compose") version "1.3.1"
}

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
google()
}

dependencies {
// Use JUnit Jupiter for testing.
testImplementation("org.junit.jupiter:junit-jupiter:5.7.2")

// This dependency is used by the application.
implementation("com.google.guava:guava:30.1.1-jre")
//usb
implementation("org.usb4java:usb4java-javax:1.2.0")
//ui 
implementation(compose.desktop.currentOs)

}

application {
// Define the main class for the application.
mainClass.set("example.AppKt")
}

any idea how to fix it ?

@themkat
Copy link
Collaborator

themkat commented Mar 28, 2023

Have you checked the language server logs? They usually give an indication of what has gone wrong. In VSCode, select the Kotlin-option in the Output-tab:
image

Kotlin Multiplatform are not fully supported, but we have some workarounds that work in a lot of cases. We should know more based upon your log output.

There might be output like in the following issue in your logs: #376 (comment)

@moshezvili
Copy link
Author

I changed the ndk and now its partially recognized, still not working. the same projects works perfectly in IntelliJ IDE.
this is the log :
[Error - 1:05:10 PM] org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Failed to generate function main
File being compiled: (20,1) in /c:\dev\renal\app\src\main\kotlin\renal\renalApp.kt
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:128)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:206)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.PackagePartCodegen.generateBody(PackagePartCodegen.java:98)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:132)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:149)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:70)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:77)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:62)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
[Error - 1:05:10 PM] at org.javacs.kt.compiler.Compiler.generateCode(Compiler.kt:570)
[Error - 1:05:10 PM] at org.javacs.kt.SourcePath.save(SourcePath.kt:275)
[Error - 1:05:10 PM] at org.javacs.kt.SourcePath.saveAllFiles(SourcePath.kt:287)
[Error - 1:05:10 PM] at org.javacs.kt.KotlinTextDocumentService$lintAll$1.invoke(KotlinTextDocumentService.kt:267)
[Error - 1:05:10 PM] at org.javacs.kt.KotlinTextDocumentService$lintAll$1.invoke(KotlinTextDocumentService.kt:265)
[Error - 1:05:10 PM] at org.javacs.kt.util.Debouncer.submitImmediately$lambda-1(Debouncer.kt:27)
[Error - 1:05:10 PM] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[Error - 1:05:10 PM] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[Error - 1:05:10 PM] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
[Error - 1:05:10 PM] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[Error - 1:05:10 PM] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[Error - 1:05:10 PM] at java.base/java.lang.Thread.run(Thread.java:833)
[Error - 1:05:10 PM] Caused by: java.lang.IllegalStateException: Error type encountered: [ERROR : Error function type] (DeferredType).
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:128)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.load.kotlin.DescriptorBasedTypeSignatureMappingKt.mapType(descriptorBasedTypeSignatureMapping.kt:83)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt:284)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapReturnType(KotlinTypeMapper.kt:226)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapReturnType(KotlinTypeMapper.kt:209)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapSignatureWithCustomParameters(KotlinTypeMapper.kt:919)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapSignature(KotlinTypeMapper.kt:836)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapSignatureWithGeneric(KotlinTypeMapper.kt:780)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.FunctionGenerationStrategy.mapMethodSignature(FunctionGenerationStrategy.java:46)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:189)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:166)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.FunctionCodegen.gen(FunctionCodegen.java:137)
[Error - 1:05:10 PM] at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:200)
[Error - 1:05:10 PM] ... 19 more
[Info - 1:05:11 PM] async3 Updating full symbol index...
[Warn - 1:05:25 PM] ..worker-1Excluding symbol com.android.tools.build.bundletool.validation.AutoValue_TextureCompressionFormatParityValidator_SupportedTextureCompressionFormats from index since its name is too long
[Warn - 1:05:47 PM] ..worker-1Excluding symbol dagger.internal.codegen.componentgenerator.CurrentImplementationSubcomponent_ChildComponentImplementationFactoryModule_ProvideChildComponentImplementationFactoryFactory from index since its name is too long
and this is a screenshot from vscode
image

@themkat
Copy link
Collaborator

themkat commented Mar 29, 2023

Good that you got it partly working 🙂 Just a quick question: which version of the language server are you using? The one that got downloaded automatically? Then that version is old, and doesn't work well with Kotlin 1.8. You can workaround this by building the language server yourself, and setting its path in the VSCode extension settings. Extension @ext:fwcd.kotlin. The relevant property is "Kotlin > Language Server: Path". You will find the necessary file after build in server/build/install/server/bin/kotlin-language-server (or a bat file if you use Windows probably).

Sadly I do not have permissions to release the project, but automatic releases are being worked on... (and will hopefully be done and approved soon'ish).

You have to go a bit earlier into the log to see anything useful for dependency resolution btw 🙂 If you go very early into the logs, you should see lines like Resolving dependencies for 'app' through Gradle's CLI using tasks [kotlinLSPProjectDeps] (or something similar). If any of those lines show "0 artifacts found" or similar, then there is an issue with the dependency resolution. Hopefully the logs might show more in this case...

@moshezvili
Copy link
Author

moshezvili commented Mar 30, 2023

thanks :-) ! I built the new version and everything is working now !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants