Я пытаюсь связать свое приложение с firebase, поэтому я добавил
путь к классам, реализация и «применить плагин» к моим файлам граддла
но когда я пытаюсь запустить приложение, возникает эта ошибка:
Ошибка слияния манифеста: значение атрибута application@appComponentFactory = (android.suсильный текстpport.v4.app.CoreComponentFactory) из [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 также присутствует в [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Предложение: добавьте 'tools:replace="android:appComponentFactory"' в элемент AndroidManifest.xml:5:5-24:19 для переопределения.
проблема в том, что когда я добавил
tools:replace = "android:appComponentFactory"
в предложениях встречалось гораздо больше ошибок. Как я могу решить эту проблему?
Вот мои файлы градиента. Модуль:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "lt.tetro.testapp"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.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.google.firebase:firebase-core:17.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
}
apply plugin: 'com.google.gms.google-services'
Проект:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
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
}
firebase-core:17.0.0
включен в AndroidX, поэтому обновите свое приложение, чтобы использовать Jetpack (AndroidX).
Вы можете проверить инструкции по следующей ссылке:
https://developer.android.com/jetpack/androidx/мигрировать
with Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
попробуйте перенести свой проект на AndroidX, у меня была такая же проблема, и она решила ее.