Open ianhanniballake opened 5 years ago
Just to add another perspective: I've encountered same issue. Bumped up jvm target to 1.8, but Kotlin compiler uses Java 8 methods not available on Android below API 24 which results in runtime crashes (like Long.hashCode(), source).
I think API pre 24 has still significant market share and for the compatibility sake ktx
libraries should target jvm 1.6.
@marcinbak - there's a separate issue tracking desugaring the Java 8 methods for older API levels, but I agree that using Kotlin shouldn't force targeting a newer version of the JVVM.
@ianhanniballake Can we use
kotlinOptions {
jvmTarget = '1.8'
}
now that desugaring as been fixed in AGP 3.4.1?
Otherwise there is no way to use core-ktx in my current app without cutting off support for Android < N
Description
When using a project that uses Kotlin but uses Java 1.6 - my actual project is a library project that is not ready to force downstream apps to compile with Java 1.7+,
I cannot use ActivityScenario.launchActivity() since it appears the core-ktx module is compiled with Java 1.7 bytecode.
Steps to Reproduce
Expected Results
core-ktx is usable on projects that compile against Java 1.6.
Actual Results
Fails with an error:
AndroidX Test and Android OS Versions
'androidx.test:core-ktx:1.1.0' (or any later version)
Link to a public git repo demonstrating the problem:
https://github.com/ianhanniballake/TestCoreKtxIssue