This article is about fixing Manifest merger failed with multiple errors in Airbnb Epoxy
  • 13-Feb-2023
Lightrun Team
Author Lightrun Team
Share
This article is about fixing Manifest merger failed with multiple errors in Airbnb Epoxy

Manifest merger failed with multiple errors in Airbnb Epoxy

Lightrun Team
Lightrun Team
13-Feb-2023

Explanation of the problem

The problem at hand is related to the gradle build process of an Android app. The app has applied the kotlin-kapt plugin and added the following dependencies:

dependencies{
//epoxy
implementation 'com.airbnb.android:epoxy:3.1.0'
annotationProcessor 'com.airbnb.android:epoxy-processor:3.1.0'
}

However, during the build process, the following error occurs:

Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs 	at com.android.builder.core.AndroidBuilder.mergeManifestsForApplication(AndroidBuilder.java:540) 	at com.android.build.gradle.tasks.MergeManifests.doFullTaskAction(MergeManifests.java:173) 	at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106) 	at sun.reflect.GeneratedMethodAccessor2235.invoke(Unknown Source) 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 	at java.lang.reflect.Method.invoke(Method.java:498) 	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) 	at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50) 	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) 	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131) 	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300) 	at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292) 	at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174) 	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) 	at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31) 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120) 	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99) 	... 34 more

The error message suggests that the manifest merger failed with multiple errors, as indicated by the message Manifest merger failed with multiple errors, see logs. The

Troubleshooting with the Lightrun Developer Observability Platform

Getting a sense of what’s actually happening inside a live application is a frustrating experience, one that relies mostly on querying and observing whatever logs were written during development.
Lightrun is a Developer Observability Platform, allowing developers to add telemetry to live applications in real-time, on-demand, and right from the IDE.

  • Instantly add logs to, set metrics in, and take snapshots of live applications
  • Insights delivered straight to your IDE or CLI
  • Works where you do: dev, QA, staging, CI/CD, and production

Start for free today

Problem solution for Manifest merger failed with multiple errors in Airbnb Epoxy

The “Manifest merger failed with multiple errors” error in Airbnb Epoxy can occur when there are conflicting dependencies in your project. Here are a few steps you can try to resolve this issue:

  1. Check for conflicting dependencies: Check if there are any dependencies in your build.gradle file that conflict with each other. You can resolve this by either removing the conflicting dependency or updating it to a compatible version.
  2. Update Gradle version: Make sure that you are using the latest version of Gradle. Updating to the latest version can resolve conflicts caused by outdated dependencies.
  3. Exclude dependencies: If you have multiple dependencies that use the same library, you can exclude the library from one of the dependencies to resolve the conflict. To do this, add the following line in your build.gradle file:
compile('com.example:dependency1') {
    exclude group: 'com.example.library'
}
  1. Clean and rebuild the project: Try cleaning and rebuilding your project. This can resolve any issues caused by incomplete or corrupted builds. To clean the project, use the following command:
./gradlew clean

If the above steps don’t work, you can also try removing the .gradle folder in your project and re-importing the project in Android Studio.

Other popular problems with Airbnb Epoxy

Problem: “Manifest merger failed with multiple errors” Error

The “Manifest merger failed with multiple errors” error occurs when there are conflicting dependencies in your project, causing the AndroidManifest.xml file to become inconsistent.

Solution:

To resolve this issue, you can check for conflicting dependencies, update the Gradle version, exclude dependencies, and clean and rebuild the project. If the above steps don’t work, you can try removing the .gradle folder in your project and re-importing the project in Android Studio.

Problem: “ViewType has not been bound” Error

This error occurs when there is a mismatch between the model class and the corresponding view in your EpoxyRecyclerView.

Solution:

To resolve this issue, you need to ensure that the model class and the corresponding view are correctly bound. This can be done by using the withModels method in your EpoxyController and calling the to method to bind the model class to the corresponding view.

Problem: Performance Issues

Performance issues can occur in Airbnb Epoxy when there are a large number of models or complex view hierarchies.

Solution:

To resolve performance issues, you can use the asyncDiffing feature in Epoxy to handle model changes asynchronously. You can also use the BatchModels feature to group multiple models together and update them in a single batch, reducing the number of view updates and improving performance. Additionally, you can use the StableIds feature to provide stable IDs for your models, enabling Epoxy to update the minimum number of views required to reflect changes in your data.

A brief introduction to Airbnb Epoxy

Airbnb Epoxy is an Android library that is used to build complex screens efficiently and easily. It provides a rich set of features for building complex and dynamic user interfaces, including automatic diffing of data, support for complex view types, and efficient recycling of views. With Epoxy, developers can create complex and dynamic screens with minimal boilerplate code, reducing the time and effort required to build complex user interfaces.

Epoxy is built on top of the RecyclerView and uses a unique data binding approach to bind data to views. It provides an EpoxyController class that acts as the data source for the RecyclerView and allows developers to describe the layout of their screens as a collection of EpoxyModels. The models can be combined and reused to build complex and dynamic user interfaces, and Epoxy automatically handles the diffing and updating of the underlying data. Additionally, Epoxy provides advanced features such as animation support, support for complex view types, and the ability to handle complex view hierarchies, making it an ideal solution for building complex and dynamic user interfaces on Android.

Most popular use cases for Airbnb Epoxy

  1. Building Complex and Dynamic User Interfaces: Airbnb Epoxy can be used to build complex and dynamic user interfaces with ease. The library provides a rich set of features for building complex and dynamic user interfaces, including automatic diffing of data, support for complex view types, and efficient recycling of views. With Epoxy, developers can create complex and dynamic screens with minimal boilerplate code, reducing the time and effort required to build complex user interfaces.
  2. Implementing List-Based User Interfaces: Airbnb Epoxy can be used to efficiently implement list-based user interfaces in Android. The library provides automatic diffing of data and efficient recycling of views, making it well-suited for implementing list-based user interfaces with a large number of items. Additionally, Epoxy provides advanced features such as animation support, making it an ideal solution for building rich and dynamic list-based user interfaces on Android.
class ItemEpoxyModel_ : EpoxyModelWithHolder<ItemEpoxyModel.Holder>() {
    var title: String by Delegates.observable("") { _, _, newValue ->
        holder.titleTextView.text = newValue
    }
    var subtitle: String by Delegates.observable("") { _, _, newValue ->
        holder.subtitleTextView.text = newValue
    }

    override fun bind(holder: Holder) {
        super.bind(holder)
        holder.titleTextView.text = title
        holder.subtitleTextView.text = subtitle
    }

    class Holder : EpoxyHolder() {
        lateinit var titleTextView: TextView
        lateinit var subtitleTextView: TextView

        override fun bindView(itemView: View) {
            titleTextView = itemView.findViewById(R.id.title)
            subtitleTextView = itemView.findViewById(R.id.subtitle)
        }
    }
}
  1. Implementing Dynamic and Responsive Layouts: Airbnb Epoxy can be used to build dynamic and responsive layouts in Android. The library provides automatic diffing of data and efficient recycling of views, making it well-suited for building dynamic and responsive user interfaces that change in response to data updates. Additionally, Epoxy provides advanced features such as animation support, making it an ideal solution for building rich and dynamic user interfaces that are both responsive and engaging.
Share

It’s Really not that Complicated.

You can actually understand what’s going on inside your live applications.

Try Lightrun’s Playground

Lets Talk!

Looking for more information about Lightrun and debugging?
We’d love to hear from you!
Drop us a line and we’ll get back to you shortly.

By submitting this form, I agree to Lightrun’s Privacy Policy and Terms of Use.