0

I'm trying to update my app to SDK 31 but when I try to run it, the app keeps crashing. I noticed that my build log is throwing a warning:

AGPBI: {"kind":"warning","text":"An API level of 31 is not supported by this compiler. Please use an API level of 30 or earlier","sources":[{}],"tool":"D8"}

Has anyone ever faced this problem?

Yaqoob Bhatti
  • 1,271
  • 3
  • 14
  • 30
Luiz Mattos
  • 11
  • 1
  • 1
  • In the gradle is the minimum Sdk 30 ?, if yes then all you have to do is change it to 31 . [here is how to change min sdk version](https://abhiandroid.com/androidstudio/change-api-sdk-level-android-studio.html#:~:text=Step%201%3A%20Open%20your%20Android,setting%20%E2%80%9CTarget%20Sdk%20Version%E2%80%9D.) – Yasser CHENIK Jan 06 '22 at 14:13
  • If its not i think you have to download latest version of android studio – Yasser CHENIK Jan 06 '22 at 14:14
  • No, the minimum sdk is 19. I'm gonna try to update my android studio – Luiz Mattos Jan 06 '22 at 14:19
  • try [this](https://stackoverflow.com/questions/70312198/an-api-level-of-31-is-not-supported-by-this-compiler-please-use-an-api-level-of) solution – Yasser CHENIK Jan 06 '22 at 14:56
  • duplicate of https://stackoverflow.com/questions/70312198/an-api-level-of-31-is-not-supported-by-this-compiler-please-use-an-api-level-of – Lakpriya Senevirathna Mar 11 '22 at 06:21

1 Answers1

-1

Use this code once for your query.

android {
  ...
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
  kotlinOptions {
    jvmTarget = '1.8'
  }
}
Apps Maven
  • 1,314
  • 1
  • 4
  • 17