Android project doesn't include generated files from aidl
When an Android project has aidl source files, the generated code is not included in source paths.
Environment
- Operating System: Windows 11
- JDK version: openjdk 11.0.12 2021-07-20
- Visual Studio Code version: 1.75.0-insider
- Java extension version: v1.14.2022122003
Steps To Reproduce
- Clone https://github.com/Genymobile/scrcpy
- Run
./gradlew assembleDebug, it builds successfully - Open
server/src/main/java/com/genymobile/scrcpy/wrappers/ClipboardManager.java
Current Result
The import android.content.IOnPrimaryClipChangedListener cannot be resolved Java(268435846)
Expected Result
No error
Additional Informations
The interface android.content.IOnPrimaryClipChangedListener is generated from server/src/main/aidl/android/content/IOnPrimaryClipChangedListener.aidl to server/build/generated/aidl_source_output_dir/debug/out/android/content/IOnPrimaryClipChangedListener.java
Yeah, aidl is not supported now. @jdneo could you help mark this issue as a feature request?
Correct me if I'm wrong, the support should be added at https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.core/gradle/android/init.gradle? If it's not too complex I want to give it a try.
@yume-chan you're right. That gradle file is an init script used when importing Android projects, which contains a Gradle plugin help buildship recognize Android project structure.
For aidl, a quick thought in my mind is that we should
- trigger Gradle task which will generate aidl files when importing. e,g,. add the task into eclipseModel.synchronizationTasks: https://github.com/eclipse/eclipse.jdt.ls/blob/da5aa2e2fcbd3f98c97e56ba623dd58d260c03f7/org.eclipse.jdt.ls.core/gradle/android/init.gradle#L61
- add the generated folder to source folders, like what we do for R files: https://github.com/eclipse/eclipse.jdt.ls/blob/da5aa2e2fcbd3f98c97e56ba623dd58d260c03f7/org.eclipse.jdt.ls.core/gradle/android/init.gradle#L347
Any progress now?