Issue
I am learning Android Dev in a 12 Month online study. After the basics my actual topic is Debugging. I followed my learning material to start the first simple JUnit test. I created the run/debug configuration like mentioned in my book for this month (even if the layout changed a bit). Then I just ran the JUnit configuration. Unfortunately I get a bunch of error:
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.appcompat:appcompat:1.4.1.
AAR metadata file: C:\Users\there\.gradle\caches\transforms-3\7c35e9ced6058ee9ee419dce8130dd8e\transformed\appcompat-1.4.1\META-INF\com\android\build\gradle\aar-metadata.properties.
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.appcompat:appcompat-resources:1.4.1.
AAR metadata file: C:\Users\there\.gradle\caches\transforms-3\356e9ba54d02d4f62b341e20ec0fc392\transformed\jetified-appcompat-resources-1.4.1\META-INF\com\android\build\gradle\aar-metadata.properties.
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.emoji2:emoji2-views-helper:1.0.0.
AAR metadata file: C:\Users\there\.gradle\caches\transforms-3\3c5e58b62ef26f85c19a76a46373f767\transformed\jetified-emoji2-views-helper-1.0.0\META-INF\com\android\build\gradle\aar-metadata.properties.
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.emoji2:emoji2:1.0.0.
AAR metadata file: C:\Users\there\.gradle\caches\transforms-3\86bbdb4c704f0c6ef69f85fd6941d5d8\transformed\jetified-emoji2-1.0.0\META-INF\com\android\build\gradle\aar-metadata.properties.
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:1.7.0.
AAR metadata file: C:\Users\there\.gradle\caches\transforms-3\fb3270031bd107031c21c5dc13d9e5ef\transformed\core-1.7.0\META-INF\com\android\build\gradle\aar-metadata.properties.
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.lifecycle:lifecycle-process:2.4.0.
AAR metadata file: C:\Users\there\.gradle\caches\transforms-3\60fb03f7868607ff1baa13fa3ab998ab\transformed\jetified-lifecycle-process-2.4.0\META-INF\com\android\build\gradle\aar-metadata.properties.
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.lifecycle:lifecycle-runtime:2.4.0.
AAR metadata file: C:\Users\there\.gradle\caches\transforms-3\f5b1cf69ca8682e4d6b881300287a614\transformed\lifecycle-runtime-2.4.0\META-INF\com\android\build\gradle\aar-metadata.properties.
I did not change any settings or something. I am way too knew to understand the config files at the moment. I tried to find a solution through google. So I tried to open the "Module Setting". Went to "Dependancies" and changed the option "core-ktx" from 1.7 to 1.6. After that I rebuild the project. But nothing changed.
Would somebody so kind and explain the problem to me and suggest me a solution? I could and maybe will contact my "Remote Teacher" of the course, because I can not continue without solving this. But waiting for an answer there could be taking longer and I would like to continue.
Thanks a lot!
Best regards!
Solution
Such as error said, a dependancy (here: androidx.appcompat:appcompat:1.4.1
) require a minimum SDK of 31.
Your project seems to require a minimum of SDK 30.
The conflict between both is created because of device with SDK 30. Such as they will run with 30, the dependancy could run, because it's in a newer version.
The opposite is allowed thanks to backwards compatibility. That's why some people make API with very low SDK, it's to prevent those type of issue.
To solve this, you can:
- Stay on SDK 30, and find an older version that require SDK 30 instead of 31. The 1.4.0 seems to do it, so you can use
androidx.appcompat:appcompat:1.4.0
. - Use at least SDK 31 as minimum compile SDK. This will break some device support, but also allow you to use some new features.
Answered By - Elikill58
Answer Checked By - Senaida (JavaFixing Volunteer)