【发布时间】:2019-07-11 23:15:04
【问题描述】:
我开始在 android studio 中构建一个项目,在添加了一些 firebase 身份验证依赖项后遇到了这个问题.. 'com.android.support:appcompat-v7:28.0.0' 下似乎有一条弯曲的红线。
这是 gradle 应用代码:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.aden.adenmarket"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-auth:18.0.0'
}
apply plugin: 'com.google.gms.google-services'
这是项目 gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
....... 这是输出错误:
错误:清单合并失败:uses-sdk:minSdkVersion 15 不能 小于库中声明的版本 16 [com.google.firebase:firebase-auth:18.0.0] C:\Users\PC.gradle\caches\transforms-2\files-2.1\ce1ab53339b3343f02313d46e1b6166b\AndroidManifest.xml 因为该库可能正在使用 15 建议中不可用的 API: 使用 minSdk 最多为 15 的兼容库,或增加 这个项目的 minSdk 版本至少要 16,或者使用 tools:overrideLibrary="com.google.firebase.auth" 强制使用(可能 导致运行时失败)
【问题讨论】: