I have some .java files I would like to include in my project but keep them in their original directory, which is external to the project directory. I do not want to copy these source files into the project src directories as other projects use them.
These are my current versions of AS and Gradle I’m using:
Android Studio Jellyfish | 2023.3.1 RC 2, Gradle 8.7, Android Gradle Plugin 8.1.4.
I’ve read the documentation on file dependencies (File Dependencies) and tried what they said but just can’t seem to make it work even though gradle doesn’t complain when I sync.
I’m not able to import the packages, Android studio cannot see them.
I think you greatly misunderstand file dependencies.
They are for cases when you have jars lying around that you want to depend on.
And they should imho never be used anyway, as they even for that use-case have significant drawbacks and better a flatDir repository with normal dependency declarations should be used.
You would have to declare an additional source directory for your source set.
I cannot tell you exactly how to do it though, as I’m not into Android development and Android is always special.
But with that information you might be able to find the right thing in the docs that you need.