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
OS of the development machine
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:
implementation "com.google.android.gms:play-services-analytics:17.0.0"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:
The problem is that version of play-services-analytics uses Android X but capacitor doesn't support Android X yet
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.
Any idea when Capacitor will support Android X?
Because this is also affecting the support of Firebase In-App Messaging
Thanks
Hi @masimplo How did you fix the Androidx situation?
@masimplo could you please share your solution?
He already said that using version 16.0.1 worked, so use implementation "com.google.android.gms:play-services-analytics:16.0.1"
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.
What is the timeline for Capacitor supporting Android X? I am running into this same issue with other third-party SDKs.
@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 https://github.com/ionic-team/capacitor/issues/1937 ? it's very very hard to find else
@nikmartin would appreciate if you could share you solution from your other thread (https://github.com/ionic-team/capacitor/issues/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.
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.
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?
Most helpful comment
Any idea when Capacitor will support Android X?
Because this is also affecting the support of Firebase In-App Messaging
Thanks