-
Notifications
You must be signed in to change notification settings - Fork 408
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
Android project has no code suggestions #3284
Comments
If someone could help me, I would be extremely grateful. 😃 |
Having exactly the same issue, seems that jdtls is not able to get the classpath from the gradle project if it is using the android gradle plugin or something. Manually adding jars from the android dependencies (extracting the .aar files to get the classes.jar file) to the .classpath file I managed to get some autocomplete, but not all. Also enabling the setting to enable android project support didn't have any effect either |
@codewithtoucans I finally managed to get it to work, but as the gradle classpath resolver is not working properly we need to workaround it adding the necessary jars from the android sdk and dependencies to the .classpath file in the app module. Here is my raw setup, but beware that some tweaking is needed depending on the project (adjusting the sdk version, configured variants, sdk path...): Add this task to the app build.gradle.kts, which is used to get the compile classpath for the declared dependencies:
And then run this script to fill the .classpath file:
I haven't configured it yet to support some features (such as viewbinding or buildconfig), but it should be straightforward to add the support for these with this base |
JDT-LS relies on Eclipse BuildShip to compute a proper Gradle classpath. Maybe the issue should also be reported at https://github.com/eclipse/buildship/issues ? |
This seems like a jdt-ls issue, as Android support was implemented directly in jdt-ls here: #2197 I also tried running this in the demo Android application that was added in that PR and experienced the same issue, so presumably something has broken the support. |
@amgdev9 It doesn't work for me. I have tried many settings, but none of them work. However, if I just run a gradle project, like a Spring Boot project, it works perfectly fine. I don't have a good idea about Android project. |
@nolanpollack @mickaelistria I looked through the #2197 PR and didn't find any configuration they mentioned, so I just followed the normal configuration, but it didn't work. The eclipse.jdt.ls wiki. |
In Android project how can I get android code suggestions?
OS: windows 10
Gradle: 6.5
JDK: installed 8, 11 ,17
IDE: Neovim 0.10.1
I set JAVA_HOME and ANDROID_HOME in the system variables, but after building the project and install dependences, no errors, I only get basic JDK code suggestions and no Android code suggestions. Do I need to make any special settings in my lua file, or is there any other configuration needed? I'm a newbie in this area and would appreciate any help! Thanks!
my config
The text was updated successfully, but these errors were encountered: