I have a project consisting of multiple gradle modules (plugin com.android.library) referencing each other (tree, not flat). I use AIDL intensively and thus it happens that I reference AIDL interfaces from one module (modA) in an AIDL interface in another module (modB).
modA/src/main/aidl/modA/foo.aidl:
package modA;
interface foo {
void modAcall();
}
modB/src/main/aidl/modB/bar.aidl:
package modB;
import modA.foo;
interface bar {
foo modBcall();
}
modB/build.gradle:
dependencies {
compile project(':modA')
}
I can reference parcelables of modA in AIDL files in modB and I can reference interfaces of modA in java code in modB, but not in AIDL in modB. Instead the error message couldn't find import for class
is shown by the aidl tool.
I noticed that .aar-files also do not contain information on the aidl interfaces of the library, only the parcelables are listed. I guess this has the same reason as the problem described above.
As I already have the aidl files in one place I don't want to copy them over to another subproject, because changes have to be manually copied over in that case. I also don't like the idea of using symlinks for this, because it feels wrong to modify the src directory of modB to include something from modA.
- Is there a way to include aidl interfaces in aar so it can be used by other modules?
- Is it possible to extend the aidl include path in Gradle to use the aidl files of the dependency module (for subprojects, it should be possible, because the aidl files are present on filesystem) without "compiling" them again (the class files of the generated java interface/classes are already included in the aar/module import)?