将Android Studio升级到3.4版后,我的项目同步报告了一个错误:
ERROR: Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 14 declared in library [androidx.legacy:legacy-support-v4:1.0.0] C:\Users\pecana\.gradle\caches\transforms-2\files-2.1\0b6817155f227f1df719b12aa7dc1519\AndroidManifest.xml as the library might be using APIs not available in 1
Suggestion: use a compatible library with a minSdk of at most 1,
or increase this project's minSdk version to at least 14,
or use tools:overrideLibrary="androidx.legacy.v4" to force usage (may lead to runtime failures)
顺便说一句,我可以构建APK并正确运行应用程序(但只能在没有即时运行的情况下运行)。我尝试添加
<uses-sdk tools:overrideLibrary="androidx.legacy.v4"/>
到主AndroidManifest.xml,但仍然发生错误。 有关如何解决此问题的任何想法?
谢谢
答案 0 :(得分:1)
由于错误提示,您还可以将项目的minSdk版本提高到14或更高版本。
转到您的build.gradle(模块应用)文件,并添加如下所示的最低SDK版本:
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 14 or above here
}
}