我最近将 cordova-android 升级到版本 12,我的应用程序不再构建,并且出现以下错误
uses-sdk:minSdkVersion 19 不能小于库中声明的版本 21
我知道我需要将最低版本提高到 21 或更高版本,我已在 config.xml 文件中完成此操作:-
<platform name="android">
...
<preference name="android-minSdkVersion" value="24" />
...
</platform>
我已经多次删除和添加平台,但仍然出现构建失败并出现上述错误的情况。我谷歌搜索的所有内容都以相同的答案结束(更改 config.xml 文件中的 android-minSdkVersion 版本)。
我正在拔头发,因为我确信这是我明显遗漏的东西,感谢您的帮助,如果您需要更多信息(使用的插件等,请告诉我)。
完整错误:
> Task :app:processDebugMainManifest FAILED
C:\www\cordova\app\platforms\android\app\src\main\AndroidManifest.xml Error:
uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [androidx.core:core-splashscreen:1.0.0] C:\Users\user\.gradle\caches\transforms-3\8fa35d5508191c4f9f8ca09de1273d1b\transformed\jetified-core-splashscreen-1.0.0\AndroidManifest.xml as the library might be using APIs not available in 19
Suggestion: use a compatible library with a minSdk of at most 19,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="androidx.core.splashscreen" to force usage (may lead to runtime failures)
See https://developer.android.com/r/studio-ui/build/manifest-merger for more information about the manifest merger.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [androidx.core:core-splashscreen:1.0.0] C:\Users\user\.gradle\caches\transforms-3\8fa35d5508191c4f9f8ca09de1273d1b\transformed\jetified-core-splashscreen-1.0.0\AndroidManifest.xml as the library might be using APIs not available in 19
Suggestion: use a compatible library with a minSdk of at most 19,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="androidx.core.splashscreen" to force usage (may lead to runtime failures)
您可能已在 gradle 构建配置中设置了最小 sdk 版本。请参阅 https://developer.android.com/build/gradle-tips#combine-multiple-product-flavors,其中显示在 gradle 文件中使用
minSdkVersion
。
只需在本地升级 Flutter 即可看到魔法发生。
flutter upgrade