TMF 组件使用到了部分 Java8 的语言特性和 API,因此需要在您模块的 build.gradle设置 compileOptions,否则可能会遇到编译与运行时问题。
android {
...
// Configure only for each module that uses Java 8
// language features (either in its source code o
// through dependencies).
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// For Kotlin projects
kotlinOptions {
jvmTarget = "1.8"
}
}
此外,如果您的 compileSdkVersion 在30以上时,需要将 Android Studio 的 Gradle Jdk 配置设置为 Java 11。
