I have been using Firebase in my Android project. Specifically: Firebase Firestore
, Firebase Authentication
, and Firebase Cloud Messaging
.
Today I decided to add Firebase Storage
to my build.gradle
as I needed the storage features. Now I'm getting an error when building the project:
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).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:8:5-214:19 to override.
Here's my build.gradle
:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.myproject.myproject"
minSdkVersion 23
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(include: ['*.jar'], dir: 'libs')
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.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.google.firebase:firebase-firestore:18.2.0'
implementation 'com.google.firebase:firebase-messaging:17.6.0'
// implementation 'com.google.firebase:firebase-storage:18.1.1' // this seems to be causing the error
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.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
implementation 'de.siegmar:fastcsv:1.0.3'
implementation 'com.github.bumptech.glide:glide:4.9.0'
}
apply plugin: 'com.google.gms.google-services'
I tried adding tools:replace="android:appComponentFactory"
to the <application>
tag in my Manifest as the error suggested but adding it didn't fix the error.
I also like to note that only the implementation 'com.google.firebase:firebase-storage:18.1.1'
dependency in my gradle is on the latest version(as of this writing).
Below Firebase dependencies are not on the latest version:
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.google.firebase:firebase-firestore:18.2.0'
implementation 'com.google.firebase:firebase-messaging:17.6.0'
I've already tried updating the dependencies above to the latest version and building but I still get the same Manifest merger failed
error.
Anyone know how to fix this error?