当前位置:   article > 正文

Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in lib

manifest merger failed : uses-sdk:minsdkversion 16 cannot be smaller than ve

问题起因:原来的app

minSdkVersion 16,如图:

接入oaid_sdk_1.0.23.aar后编译不通过,提示:

Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:oaid_sdk_1.0.23:] E:\Android\androidCache\.gradle\caches\transforms-2\files-2.1\56300240547bb0708ea484d8691618a6\oaid_sdk_1.0.23\AndroidManifest.xml as the library might be using APIs not available in 16
    Suggestion: use a compatible library with a minSdk of at most 16,
        or increase this project's minSdk version to at least 21,
        or use tools:overrideLibrary="com.bun.miitmdid" to force usage (may lead to runtime failures)
如图:

解决方案

打开AndroidManifest.xml文件,加入如下两行代码

根目录:
xmlns:tools="http://schemas.android.com/tools"

根目录下方

<uses-sdk tools:overrideLibrary="com.bun.miitmdid"/>

(注意:overrideLibrary后面不能随意加,报错点提示什么就应该填什么,比如我的是:com.bun.miitmdid,如果有多个,它们之间用逗号隔开)

这样就OK了,我手头上没有21以下的手机,无法测试是否会出现异常,为了防止异常,在调用相对应的的aar方法时最好做个版本判断,比如:我的是因为导入的oaid_sdk_1.0.23.aar要求最低版本是21,所以我在调用oaid方法时做个版本判断,如图所示:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/262364
推荐阅读
相关标签
  

闽ICP备14008679号