Today we see the common andorid studio error for java/kotlin and its solution.
The minCompileSdk (31) specified in a dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties) is greater than this module's compileSdkVersion (android-30). Dependency: androidx.core:core-ktx:1.7.0-alpha02. AAR metadata file: C:\Users\mohammad.zeeshan1.gradle\caches\transforms-2\files-2.1\a20beb0771f59a8ddbbb8d416ea06a9d\jetified-core-ktx-1.7.0-alpha02\META-INF\com\android\build\gradle\aar-metadata.properties.
You would see the above error while building the app and install to device, this error is because of dependency
See Dependency: androidx.core:core-ktx:1.7.0-alpha02
To solve this we need to lower down the dependency according to our installing device sdk version, Just follow pictures below
1. Right click on "app" and select "Open module settings"
2. Click on Dependencies, and choose your dependency according to error in our case androidx.core:core-ktx:1.7.0-alpha02
So just choose lower version and hit OK
3. Now rebuild the app and see the error will fix.
If you have still issue post your error in comment section and we will try to fix them for you, just need to focus on the install device dependencies that required,
Hope you find this page useful, keep searching and keep learning