dependencies {
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
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'
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'
}
These are the dependencies, in build.gradle
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 element at AndroidManifest.xml:7:5-21:19 to override.
I wished to add a library to my project, it is called as ButterKnife library, before adding this library the project was fine, but as I added this library. Manifest merger failed error occurred.
What I have tried? I added these lines to my AndroidManifest.xml:
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"
But this generated another set of errors
Caused by: com.android.tools.r8.utils.AbortException: Error: Static interface methods are only supported starting with Android N (--min-api 24): void butterknife.Unbinder.lambda$static$0()
I tried removing butterknife library, and then it builds finely.
I also tried adding only one of those lines:
tools:replace="android:appComponentFactory"
This did nothing and produced yet another error:
Manifest merger failed with multiple errors, see logs
I tried Refractor->migrate to androidx, this created a new problem in Java file, which now says that it "cannot resolve symbol R"
So what should I do, I am following some course online for app development. And the person teaching this course does not seem to have these errors.
I think there is something wrong in the current version (latest) of butterknife. The simplest solution that I found for this problem is that change the version that butterknife applies to.
I changed this
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
to this
implementation 'com.jakewharton:butterknife:7.0.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:7.0.1'
What we have done is that we now are going to use the older version of butterknife, the version which works.