So here, I have getHelloString
in moduleB
fun getHelloString(firstName: String): String {
return "Hello $firstName"
}
Then I will change it to:
fun getHelloString(firstName: String, lastName: String = ""): String {
return "Hello $firstName $lastName"
}
And the android app will crash
java.lang.NoSuchMethodError: No static method getHelloString(Ljava/lang/String;)Ljava/lang/String; in class Lcom/example/module/b/HelloStringKt; or its super classes (declaration of 'com.example.module.b.HelloStringKt' appears in /data/app/com.example.myapplication-x5EvJ6MhyrRk76EACAwBsg==/base.apk)
Steps:
- Clone the project
- Publish
moduleB
v1.0.0 by./gradlew moduleB:publishToMavenLocal
- Publish
moduleA
v1.0.0 by./gradlew moduleA:publishToMavenLocal
- Run module
app
, it should work fine and show "Hello Khang" text - Update method
getHelloString
inmoduleB
fun getHelloString(firstName: String, lastName: String = ""): String {
return "Hello $firstName $lastName"
}
- Update
moduleB/build.gradle
, set new version"1.0.1"
- Re-publish
moduleB
v1.0.1 by./gradlew moduleB:publishToMavenLocal
- Update
app/build.gradle
setmoduleB
version to1.0.1
- Rebuilt and install
app
successfully, but it crashes.