你好,我对安卓还不太熟悉,
目前我遇到了一个关于本地日期(或者任何其他我尝试过的日期格式)的大问题。
LocalDate currentDate = LocalDate().now();
这行代码产生了以下错误:
Call requires API Level 26 (current min is 21)
我完全理解这意味着什么,但是我无法更改项目的API级别(因为我和我的伙伴与老师签署了合同,要按照我们计划的方式完成学校项目)。
我如何在API Level 21中使用任何类型的日期?
Gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.fragment"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "0.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
android {
compileOptions {
coreLibraryDesugaringEnabled true
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-database:19.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.firebase:firebase-client-android:2.5.2'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'me.dm7.barcodescanner:zxing:1.9'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:22.0.0'
implementation 'com.google.code.gson:gson:2.8.6'
}