I am migrating my Android project to AndroidX libraries. Butterknife 10.x has improved support for it, so i think it is good to use that. My project is made in Kotlin (1.3.30).
Butterknife versions >8 require that you use Java 8 like this:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
This works great for minsdk >=24. And for a good part it works with lower versions too. But as Kotlin compiles to Java 8 some features dont work on minsdk <24. Such as the one that i am getting the following exception for.
java.lang.NoSuchMethodError: No static method hashCode(J)I in class Ljava/lang/Long; or its super classes (declaration of 'java.lang.Long' appears in /system/framework/core-libart.jar)
Long.hashCode() is a new api in Java 8, but not supported in older android versions. This question solves the same problem by telling the compiler to use Java 6, but that is unsupported with butterknife 10.x which i need for AndroidX.
I suppose this is quite a common issue, but i have not found a solution for it. How can i solve this?