Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 of 7 tasks
masimplo opened this issue Jul 17, 2019 · 12 comments
Closed
2 of 7 tasks

Comments

@masimplo
Copy link

masimplo commented Jul 17, 2019

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:

@jcesarmobile
Copy link
Member

The problem is that version of play-services-analytics uses Android X but capacitor doesn't support Android X yet

@masimplo
Copy link
Author

Ah... so I should use a version prior to June 17 2019 that AndroidX was introduced, like 16.0.1.
Thanks for the quick response.

@mrahmadt
Copy link

mrahmadt commented Jul 22, 2019

Any idea when Capacitor will support Android X?

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

Thanks

@THEDOWNCOUNTRY
Copy link

Hi @masimplo How did you fix the Androidx situation?

@THEDOWNCOUNTRY
Copy link

@masimplo could you please share your solution?

@jcesarmobile
Copy link
Member

He already said that using version 16.0.1 worked, so use implementation "com.google.android.gms:play-services-analytics:16.0.1"

@THEDOWNCOUNTRY
Copy link

Yes but I was asking a step by step but I figured it out just searching for all firebase dependencies and make sure they are in a version number that is previous of Jun with this link https://mvnrepository.com/artifact/com.google.firebase.

@andre-arsenault
Copy link

What is the timeline for Capacitor supporting Android X? I am running into this same issue with other third-party SDKs.

@Nasicus
Copy link

Nasicus commented Oct 7, 2019

@jcesarmobile we are also blocked by this.... we are using MSAL for android (https://github.com/AzureAD/microsoft-authentication-library-for-android) and in the newest release they started using AndroidX. Therefor we cannot upgrade to the new (and first) stable version of the library.

Is there any chance we can help to test or do something for this?
Or is there a specific reason why capacitor does not want to upgrade to AndroidX?

Is there any workaround apart from using old versions the SDK's?

Edit:
@jcesarmobile could you add the keyword AndroidX (without space) to the issue #1937 ? it's very very hard to find else
@nikmartin would appreciate if you could share you solution from your other thread (#1937) and/or explain what you did to make it work...I'd happily accept a workaround for now.

If you guys thinks it's best to open a new issue for this, then I can also do that.

@OoDeLally
Copy link

I had the same problem, trying to figure out what the heck brings androidx, since I'm not using it anywhere.
Turns out Capacitor uses the following dep:
implementation 'com.google.firebase:firebase-messaging:18.0.0'
Android Studio recommends to upgrade it to
implementation 'com.google.firebase:firebase-messaging:20.0.1'

Big mistake. Keep it religiously at 18.0.0, and everything will be fine.

@sta55en
Copy link

sta55en commented 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?

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 12, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants