In Android app, when different versions of a library have been used in the different libs the app depends on, not clear that how it will affect the final apk's build. Here is a simplified case to show the question:
There are two 3rd party libs, call it comm_lib, lib_A. The Lib_A has dependency on comm_Lib:2.0.0
commen_Lib version 2.0.0 has functions:
class Comm {
fun commFunc() {printlin("in commFunc ver 2.0.0"}
fun func200{printlin("in func200"}
}
commen_Lib version 3.0.0 has removed func200 and added func300, and changed implementation:
class Comm {
fun commFunc() {printlin("in commFunc ver 3.0.0"}
fun func300{printlin("in func300"}
}
The Lib_A has dependency comm_Lib:2.0.0.
Lib_A using comm_Lib:2.0.0
class LibAclass {
fun libAFunc() {
val comm = Comm()
comm.commFunc() // expect to see "in commFun ver 2.0.0"
comm.func200() // func200 is available in comm_Lib ver 2.0.0
}
}
The app has dependency on latest version of Lib_A and comm_Lib:3.0.0.
app using comm_Lib:3.0.0
fun appFunc{
val comm = Comm()
comm.commFunc() // want to see "in commFun ver 3.0.0"
comm.func300(). // available in comm_Lib:3.0.0
val libA = LibAclass()
libA.libAFunc() //<=== lib_A was build with comm_Lib:2.0.0, will its calling comm.func200() fail?
}
I guess in this case the app's dependency graph the comm_Lib should be solved to comm_Lib:3.0.0.
In this case what will happen when the app calls libA.libAFunc()? will it get the ... not found ... error on the call to the comm.func200()?
In the other way around, if the Lib_A was built with comm_Lib:3.0.0, and app is using comm_Lib:2.0.0
Lib_A is using comm_Lib:3.0.0
class LibAclass {
fun libAFunc() {
val comm = Comm()
comm.commFunc() // expect to see "in commFun ver 3.0.0"
comm.func300(). // func300 is available in comm_Lib ver 3.0.0
}
}
The app has dependency on latest version of Lib_A and comm_Lib:2.0.0.
app using comm_Lib:2.0.0
fun appFunc{
val comm = Comm()
comm.commFunc() // want to see "in commFun ver 2.0.0"???
comm.func200() //<== will it get compile error since the comm_Lib is resolved to 3.0.0
val libA = LibAclass()
libA.libAFunc()
}