Suggestion: use a compatible library with a minSdk of at most 16, or increase this project's minSdk

MyhEhud發表於2019-05-16

今天在整合三方SDK是出現**Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:device_sdk-release:]**詳細資訊如下:
Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:device_sdk-release:] C:\Users\geo\.gradle\caches\transforms-1\files-1.1\device_sdk-release.aar\e529280690e69043be9b8f9fc1e329c8\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 19, or use tools:overrideLibrary="xxx" to force usage (may lead to runtime failures)
在這裡插入圖片描述

原因

造成這種問題的原因是自己專案的minSdkVersion比三方SDK的的minSdkVersion低,即版本不一致導致的。

解決辦法

其實在上面的日誌中也給出了這種問題的三種解決方案:

  1. Suggestion: use a compatible library with a minSdk of at most 16:將三方庫的minSdkVersion
    降低,這種方案一般是不可行,我們自己無法修改對方的SDK的minSdkVersion。
  2. increase this project's minSdk version to at least 19:提高自己專案的minSdkVersion大於等於三方的即可。
  3. use tools:overrideLibrary="com.android.device.geo.device_sdk" to force usage :在AndroidMainifest.xml中加入下面加上:
    <uses-sdk tools:overrideLibrary="三方庫的包名"/>即可。

相關文章