CLOSED
We are trying to integrate android library (which is compiling android support library) in our project that has been migrated to androidX. And for unknown reason we are getting
can't find referenced method 'void addOnTabSelectedListener(com.google.android.material.tabs.TabLayout$OnTabSelectedListener)' in program class com.google.android.material.tabs.TabLayout
while trying to get a proguard enabled build.
gradle-wrapper: 4.8
gradle build tools : 3.2.0
compileSdkVersion 28
EDIT 9-Oct-2018
For some reason, it was a proguard issue, proguard was showing wrong error, after we made some changes in our sourcecode, and forgot to add some classes to proguard, it changed the errors with the classes that we forgot to add. and after adding them everything went good.
I think that you should tell to proguard to not obfuscate material classes. But this is just a workaround, you have some other issue so try to fix it.
Try to add these lines in your proguardrules.pro file:
-keep class com.google.android.material.** { *; }
-dontwarn com.google.android.material.**
-dontnote com.google.android.material.**
-dontwarn androidx.**
-keep class androidx.** { *; }
-keep interface androidx.** { *; }
Then, in your build.gradle
buildscript {
repositories {
maven {
url "http://storage.googleapis.com/r8-releases/raw/master"
}
}
dependencies {
classpath 'com.android.tools:r8:ff9c89416cc1c8adf83d481a1e5fd515fcb893b9'
classpath 'com.android.tools.build:gradle:your version'
}
}