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

报错信息:

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :loginlibrary:generateDebugSources, :loginlibrary:generateDebugAndroidTestSources, :loginlibrary:mockableAndroidJar, :mainlibrary:generateDebugSources, :mainlibrary:generateDebugAndroidTestSources, :mainlibrary:mockableAndroidJar, :dynalibrary:generateDebugSources, :dynalibrary:generateDebugAndroidTestSources, :dynalibrary:mockableAndroidJar, :baselibrary:generateDebugSources, :baselibrary:generateDebugAndroidTestSources, :baselibrary:mockableAndroidJar]
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [:loginlibrary] F:\2020workspace\xiaohongshu\Client\loginlibrary\build\intermediates\manifests\full\debug\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="com.banwxf.loginlibrary" to force usage (may lead to runtime failures)
Information:BUILD FAILED in 5s
Information:1 error
Information:0 warnings
Information:See complete output in console

Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in lib_第1张图片

 

问题分析:

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library [:loginlibrary]

这行日志就能看出原因,合并配置文件错误。原因就是你的项目中引用了多个library项目,而你的主要的项目的build.gradle中的配置是这样的,最小配置的是19.而你library中配置是21,比你主程序的要大导致两个冲突,他告诉你你的库项目不支持19的版本。

Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in lib_第2张图片

 

解决办法:

将所有library项目中的版本和主项目app的保持一致即可

你可能感兴趣的:(Manifest merger failed : uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in lib)