fwcd / kotlin-language-server

Kotlin code completion, diagnostics and more for any editor/IDE using the Language Server Protocol
MIT License
1.67k stars 210 forks source link

LSP can't find android, androidx reference #411

Closed Savuth-S closed 1 year ago

Savuth-S commented 1 year ago

I'm using Nvim with this LSP and for some reason it can't recognize the android and androidx packages and I'm not sure what I'm doing wrong.

image

themkat commented 1 year ago

Hard to say whats wrong without seeing the language server logs. My main guess is that you use Gradle, and the dependency resolution fails. As this is Android, my main guess is that you might have an error like I describe here: https://github.com/fwcd/kotlin-language-server/issues/376#issuecomment-1200469944

If you can share your language server logs (during project initialisation) that would be great :) Then we can hopefully see what the issue is in your case.

Savuth-S commented 1 year ago

Hard to say whats wrong without seeing the language server logs. My main guess is that you use Gradle, and the dependency resolution fails. As this is Android, my main guess is that you might have an error like I describe here: #376 (comment)

If you can share your language server logs (during project initialisation) that would be great :) Then we can hopefully see what the issue is in your case.

Heres the log, ill be checking the thread you mentioned. thank you.

Savuth-S commented 1 year ago

After reading the log I've figured out its probably my java version, however I do have JAVA 11 installed, and I already tried changing the environment variable and adding the bin to the path but LSP still wont take, I even uninstalled java 19 and still refuses to use java 11. Not sure if I'm doing something wrong

Savuth-S commented 1 year ago

Yes that was it, it got fixed after setting the env to the java 11 on the lsp setup in my .vimrc

image

fmorroni commented 4 months ago

Hi, I'm having this same issue but it wasn't fixed by adding the cmd_env setup option. I'm trying to work on a small android project but I get unresolved reference errors everywhere. Any idea what else could be the problem? I tried looking at the lsp logs but I could't decipher much out of it.