android - 清单合并失败:uses-sdk:minSdkVersion 15 不能小于库中声明的版本 16
问题描述
当我尝试构建 apk 时,出现此错误:
Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.google.firebase:firebase-messaging:19.0.1] C:\Users\taha\.gradle\caches\transforms-2\files-2.1\eff6e7bdbf3eaa269c101b27c652fb15\AndroidManifest.xml as the library might be using APIs not available in 15
Suggestion: use a compatible library with a minSdk of at most 15,
or increase this project's minSdk version to at least 16,
or use tools:overrideLibrary="com.google.firebase.messaging" to force usage (may lead to runtime failures)
这是gradle构建。我尝试将 SDK 版本从 27 更新到 28,但没有成功:
android {
compileSdkVersion 27
defaultConfig {
applicationId ''
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.13-beta-3'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:palette-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.google.android.gms:play-services-ads:18.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.onesignal:OneSignal:3.10.9'
implementation 'com.google.android.ads.consent:consent-library:1.0.7'
}
apply plugin: 'com.google.gms.google-services'
解决方案
根据Google Play 服务博客文章,Google Play 服务和 Firebase,包括该com.google.firebase:firebase-messaging
库已移至minSdkVersion
16 个。您需要将您的更改minSdkVersion
为 16 或移回所有库的旧版本。
推荐阅读
- php - Laravel 5.4 – 创建外观时出错
- html - 更改图像的边距值没有生效
- java - 无法执行子进程“'scriptName.sh”(没有这样的文件或目录)
- swift3 - 如何在swift中渐变tableview的背景
- apache-spark - Sparkconf 和 Sparkcontext 有什么区别?
- javascript - 指定哪个范围输入受哪个文本输入影响,反之亦然
- mysql - 在 SQL 语句中转义或使用 C 字符串
- c# - C# MVC:上传图像在本地工作,暂存失败:GDI+ 中发生一般错误
- azure-storage - 审核 Azure 文件存储服务
- javascript - JavaScript 正则表达式仅适用于第一个字符字母,第二个及以后的字符可以是字母数字或特殊字符(连字符、逗号和空格)