Android androidx.startup:startup-runtime的minCompileSdk问题

汪永春
2023-12-01

集成第三方SDK,集成AAR遇到问题:

Caused by: java.lang.RuntimeException: The minCompileSdk (30) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-28)

看起来是minCompileSdk的问题。但是因为项目的代码涉及到系统代码,改minCompileSdk会造成其他问题,所以不能更改。

解决方案:
新创建一个新的App,来集成该SDK。

发现Jetpack的很多组件有这问题,都有环境要求。

 //The minCompileSdk (31) for 1.1.1
 //The minCompileSdk (30) for 1.1.0
 // 28 in version-1.0.0 is ok
    implementation "androidx.startup:startup-runtime:1.1.1"
    //The minCompileSdk (30)
    implementation "androidx.datastore:datastore:1.0.0"
    implementation "androidx.datastore:datastore-preferences:1.0.0"
 类似资料: