Anand Suthar
Lurker
There are two modules:
Then converted all the classes of lib-wrapper from java to kotlin.
-keep class kotlin.*.* { *; }
-keep class kotlin.Metadata { *; }
-dontwarn kotlin.**
-keepclassmembers class **$WhenMappings {
<fields>;
}
-keepclassmembers class kotlin.Metadata {
public <methods>;
}
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
public static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
}
Plugins used in lib-wrapper’s build.gradle file:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'
apply plugin: 'org.jetbrains.dokka-android'
Plugins used in app module’s build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
Any help would be appreciated. Thanks in advance.
- app (main/application module which contains both Java and Kotlin classes)
- lib-wrapper (Android-library module which contains Java classes)
Then converted all the classes of lib-wrapper from java to kotlin.
- Now, all the java classes (in app module) which are calling lib-wrapper methods show “Cannot resolve symbol” in red.
- There is no problem with kotlin classes (in app module) which are calling lib-wrapper methods.
- Even with “Cannot resolve symbol” in java classes, app compiles and runs without error. But for new users it is very tough to use lib-wrapper as it won’t show library classes and methods as an auto-complete suggestion.
- Decompiling the apk file, lib-wrapper classes shows all intended classes and methods are public and public members are plain/de-obfuscated. (Which is expected.)
- If I disable Proguard (“minifyEnabled false” in lib-wrapper’s build.gradle), everything works fine.
-keep class kotlin.*.* { *; }
-keep class kotlin.Metadata { *; }
-dontwarn kotlin.**
-keepclassmembers class **$WhenMappings {
<fields>;
}
-keepclassmembers class kotlin.Metadata {
public <methods>;
}
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
public static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
}
Plugins used in lib-wrapper’s build.gradle file:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'
apply plugin: 'org.jetbrains.dokka-android'
Plugins used in app module’s build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
Any help would be appreciated. Thanks in advance.