我想从另一个时间字符串中减去30分钟,但是在较低版本(如0.5,0.6,0.7
(棒棒糖、Marshmallow、Naught) )上会出现此错误。
错误如下:
java.lang.NoClassDefFoundError:失败的决议: Ljava/time/format/DateTimeFormatter;
发布于 2022-07-18 05:39:00
我通过在模块级build.gradle文件中添加这些行来解决这个问题
这是因为在api 26中添加了Java.time,所以下面的26会在app中抛出一个错误。
只需添加以下行
android {
defaultConfig {
// Required when setting minSdkVersion to 20 or lower
multiDexEnabled true
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}
确保multiDexEnabled真在版本和调试中都是正确的
https://stackoverflow.com/questions/57203186
复制相似问题