question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Overriding an implementation version in app gradle leads to Manifest merger failed

See original GitHub issue

Description of the problem: When adding an implementation override in build.gradle and try to run the app or produce an APK I get this error:

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:5:5-75:19 to override.

Affected platform

  • Android
  • iOS
  • electron
  • web

OS of the development machine

  • Windows
  • macOS
  • linux

Other information: Plugins I am using:

    "branch-cordova-sdk": "3.1.5",
    "cc.fovea.cordova.purchase": "8.1.1",
    "cordova-launch-review": "3.1.1",
    "cordova-plugin-appminimize": "1.0.1",
    "cordova-plugin-appsflyer-sdk": "4.4.19",
    "cordova-plugin-badge": "0.8.8",
    "cordova-plugin-call-number": "1.0.1",
    "cordova-plugin-camera": "4.0.3",
    "cordova-plugin-camera-preview": "0.11.0",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-facebook4": "4.2.1",
    "cordova-plugin-globalization": "1.11.0",
    "cordova-plugin-google-conversion-tracker": "^1.0.1",
    "cordova-plugin-googleplus": "7.0.2",
    "cordova-plugin-local-notification": "0.9.0-beta.3",
    "cordova-plugin-network-information": "^2.0.2",
    "cordova-plugin-x-socialsharing": "5.4.7",
    "cordova-sms-plugin": "1.0.0",
    "cordova-sqlite-storage": "3.2.1",
    "pouchdb-adapter-cordova-sqlite": "2.0.6",
    "skwas-cordova-plugin-datetimepicker": "2.0.0",

Capacitor version: 1.1.0 node version: v10.15.3 npm version: 6.9.2 CocoaPods version:

Steps to reproduce:

  1. Add an override in build.gradle at the app level like: implementation "com.google.android.gms:play-services-analytics:17.0.0"
  2. The project syncs and builds but does not run or produce an APK.

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.app">

    <application
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fb_app_id"/>
        <meta-data android:name="com.facebook.sdk.ApplicationName" android:value="@string/fb_app_name" />
        <activity android:name="com.facebook.FacebookActivity"
                  android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
                  android:label="@string/fb_app_name" />

        <meta-data android:name="io.branch.sdk.BranchKey" android:value="key_test_lnp7UZ5O92FOR0aOTsMc7ekcEyjX7m3T"/>
        <meta-data android:name="io.branch.sdk.TestMode" android:value="false"/>

        <activity
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
            android:name="com.example.android.MainActivity"
            android:label="@string/title_activity_main"
            android:theme="@style/AppTheme.NoActionBarLaunch"
            android:launchMode="singleTask">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/custom_url_scheme" />
            </intent-filter>

            <intent-filter android:name="io.branch.sdk.UriScheme">
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="example"/>
            </intent-filter>

            <intent-filter android:name="io.branch.sdk.AppLink" android:autoVerify="true">
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:host="link.example.com" android:scheme="https"/>
            </intent-filter>

        </activity>

        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"></meta-data>
        </provider>

        <receiver android:name="io.branch.referral.InstallListener" android:exported="true">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER"/>
            </intent-filter>
        </receiver>
    </application>

    <!-- Permissions -->

    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Camera, Photos, input file -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- Geolocation API -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature android:name="android.hardware.location.gps" />
    <!-- Network API -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- Navigator.getUserMedia -->
    <!-- Video -->
    <uses-permission android:name="android.permission.CAMERA" />
    <!-- Audio -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
</manifest>

Link to sample project:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
mrahmadtcommented, Jul 22, 2019

Any idea when Capacitor will support Android X?

Because this is also affecting the support of Firebase In-App Messaging

Thanks

8reactions
sta55encommented, Apr 7, 2020

So fresh out of the box, I’m seeing the same thing happen with no external libraries. Does that mean that Capacitor 1.5.x doesn’t work with Android now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "Manifest merger failed" error after updating to a new ...
Put this at the end of your app module build.gradle: ... Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.2) from ...
Read more >
Manage manifest files - Android Developers
This page describes how manifest merging works and how you can apply merge preferences to resolve merge conflicts.
Read more >
ERROR: Manifest merger failed - Google Groups
I tried to connect my App with Firebase, but there is always this Error: ERROR: Manifest merger failed : Attribute application@appComponentFactory ...
Read more >
Manifest merger failed on android - Capacitor - Ionic Forum
xml:6:5-44:19 to override. And here's my full package.json file: { "name": "THIS IS MY APPLICATION NAME", "version" ...
Read more >
Android - Sentiance
Problem: This error is likely due to the app using a different version of the play-services-* libraries than the Sentiance SDK.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found