我开始在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”强制使用(可能 导致运行时失败)
答案 0 :(得分:0)
尝试将minSdkVersion更改为16。
答案 1 :(得分:0)
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.aden.adenmarket"
minSdkVersion 16
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'
}
} }
在gradle文件中将minSDK更改为16 如果您还有其他带有等级的Loacal图书馆,请也将其更改
答案 2 :(得分:0)
更新项目build.gradle
buildscript {
repositories {
jcenter()
mavenCentral()
google()
maven { url 'http://repo.maven.apache.org/maven2' }
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
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
}
应用程序模块gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion 28.0.3
defaultConfig {
applicationId "com.aden.adenmarket"
minSdkVersion 19
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'
如果它以lint显示,还更新其他依赖项。
答案 3 :(得分:0)
如果要使用Firebase> = 17.0.0,则必须迁移到androidx
https://firebase.google.com/support/release-notes/android#update_-_june_17_2019