1

Bonjour Anytime I use any of these functions, I get the error : The application's minSdkVersion is newer than the device API level.

    LocalDate.now();
    YearMonth yearMonth = YearMonth.from(date);
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM yyyy");
    String recher_mois=date.format(formatter).toString();
    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMMM yyyy");

The API level min is 26 to use this functions and my tablet is 22

Is there another way to call these functions? an old fashion or a cross level way? or do I have to buy another tablet to test my app?

Beside that, the app functions well on my 2020 phone.

Thanks in advance for your help David

Here what I tried i did modify the gradle

android {
compileSdk 32

defaultConfig {
    applicationId "com.example.calendriernew"
    minSdk 22
    targetSdk 32
    versionCode 2
    versionName "1.0"

    //ajout pour time
    multiDexEnabled true



    testInstrumentationRunner 
"androidx.test.runner.AndroidJUnitRunner"
}


//funtion compileoptions ajout pour time
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.0.9'

 }

Now I got the error:

Installation failed due to: 'Failed to commit install session 1719068954 with command pm install-commit 1719068954. Error: INSTALL_FAILED_VERIFICATION_FAILURE'

I did update the tablet but same problem

Finaly it works Maybe I had to restart

I leave my post, maybe it will help

Thank you

Ole V.V.
  • 81,772
  • 15
  • 137
  • 161
tidave971
  • 13
  • 4
  • Yes. Look into core library desugaring to use java.time on API levels lower than 26 (for example 22). Search for details. – Ole V.V. Jul 13 '22 at 12:30
  • Does this answer your question? [Convert String Date to Date in Android (Java/Kotlin) without having to deal with Call requires API level 26](https://stackoverflow.com/questions/68191152/convert-string-date-to-date-in-android-java-kotlin-without-having-to-deal-with) – Ole V.V. Jul 13 '22 at 14:34
  • There’s [a new and good answer to a duplicate question here](https://stackoverflow.com/a/73023269/5772882). – Ole V.V. Jul 24 '22 at 08:52

0 Answers0