android - 由于 Androidx 和 Android 支持最新版本之间的冲突导致构建错误
问题描述
由于标题中定义的一些冲突,我遇到了构建错误。这是我的错误:
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
这是我的 build.grade 文件:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.****.****"
minSdkVersion 17
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
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.google.firebase:firebase-database:18.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.firebase:firebase-messaging:19.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-core:17.0.0'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.firebase:firebase-storage:18.0.0'
implementation 'com.sdsmdg.harjot:vectormaster:1.1.3'
}
apply plugin: 'com.google.gms.google-services'
模块级别的 build.gradle 是:
buildscript {
ext.kotlin_version = '1.3.40'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven{
url "https://maven.google.com"
}
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
有人可以给我指点这里的问题吗?在我更新了 android studio 并在其中添加了 firebase 存储之后,该错误才开始出现
只需添加:
implementation 'com.android.support:appcompat-v7:28.0.0'
给我一个错误如下:
Dependencies using groupId com.android.support and androidx.* can not be combined but found IdeMavenCoordinates{myGroupId='com.android.support', myArtifactId='support-fragment', myVersion='28.0.0', myPacking='aar', myClassifier='null'} and IdeMavenCoordinates{myGroupId='androidx.versionedparcelable', myArtifactId='versionedparcelable', myVersion='1.0.0', myPacking='aar', myClassifier='null'} incompatible dependencies
解决方案
推荐阅读
- sql - 从 Postgres jsonb 数组中提取最早日期
- ruby-on-rails - Rails postgres时间属性不保存
- javascript - Firestore - 根据 Firestore 收集文档的内部数据对数据进行排序
- rust - 限制 Rust 程序中的 cpurate
- c# - 模拟 ClaimsPrincipal 类上的扩展方法以在 HttpContext.User 中使用
- sql - SQL - 加入 3 个表,但显示中间表中缺少数据的位置
- css - 我可以在 CSS 网格中沿垂直轴 (y) 居中网格项目而不将容器的高度折叠到内容高度吗?
- python - Firebase 函数 - 使用 Python 推送通知
- angular - d3 - 使用嵌套/组创建查找
- html - 是否可以在不更改其父级的情况下更改网格容器开始/结束之外的背景颜色?