I have a multi-project setup. Consider two separate apps AppA and AppB. AppA has two library modules modA and modB. modA has a dependency on modB via gradle API.
consider modA build.gradle
file
dependencies {
api project(":mobB")
}
modA has a file ModASample.kt
which looks like
class ModASample{
fun modASample(){
println("modASample")
}
}
modB has a file ModBSample.kt
which looks like
class ModBSample{
fun modBSample(){
println("modBSample")
}
}
AppA build.gradle
file
dependencies {
implementation project(":modA")
}
from a class in appA AppASample.kt
class AppASample{
fun access(){
val modA = ModASample() //accessible
val modB = ModBSample() //accessible
}
}
both ModASample
and ModBSamle
are accessible which is expected as well because modB is used in modA via api
access.
The issue arises when I try to extract an aar
of modA
and try to use this aar in AppB
.
AppB has build.gradle
file which looks like this
dependencies {
implementation project(":modA")
}
Now this time an aar
of modA is prepared and is added as a separate module.
From a class AppBSample.kt
class AppASample{
fun access(){
val modA = ModASample() //accessible
val modB = ModBSample() // NOT ACCESSIBLE
}
}
Can anyone please provide some insight why is this happening. I was expecting modB will be accessible but that is not the case if direct aar is used.
Any suggestions will be appreciated.