Ionic with Cordova, compilation error with AndroidManifest.xml

1

When I give my command to compile my project in Ionic and Cordova, I get the following message:

:mergeArmv7DebugResources UP-TO-DATE
        :processArmv7DebugManifestC:\apps\vovocooks-v10\platforms\android\AndroidManifest.xml:28:13-35 Error:
                Attribute meta-data#android.support.VERSION@value value=(26.1.0) from [com.android.support:appcompat-v7:26.1.0]
        AndroidManifest.xml:28:13-35
                is also present at [com.android.support:support-v13:26.0.2] AndroidManifest.xml:28:13-35 value=(26.0.2).
                Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to
        override.


        See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

        :processArmv7DebugManifest FAILED

        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':processArmv7DebugManifest'.
        > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.1.0) from
        [com.android.support:appcompat-v7:26.1.0] AndroidManifest.xml:28:13-35
                is also present at [com.android.support:support-v13:26.0.2] AndroidManifest.xml:28:13-35 value=(26.0.2).
                Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to
        override.

        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

        BUILD FAILED

        Total time: 3.75 secs
        Error: cmd: Command failed with exit code 1 Error output:
        C:\apps\vovocooks-v10\platforms\android\AndroidManifest.xml:28:13-35 Error:
                Attribute meta-data#android.support.VERSION@value value=(26.1.0) from [com.android.support:appcompat-v7:26.1.0]
        AndroidManifest.xml:28:13-35
                is also present at [com.android.support:support-v13:26.0.2] AndroidManifest.xml:28:13-35 value=(26.0.2).
                Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to
        override.

        FAILURE: Build failed with an exception.

        * What went wrong:
        Execution failed for task ':processArmv7DebugManifest'.
        > Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.1.0) from
        [com.android.support:appcompat-v7:26.1.0] AndroidManifest.xml:28:13-35
                is also present at [com.android.support:support-v13:26.0.2] AndroidManifest.xml:28:13-35 value=(26.0.2).
                Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:26:9-28:38 to
        override.

        * Try:
        Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

At first I thought the problem was the google.service.jason of the Google Messenge FCM, I set it up, but now it's in some configuration of my AndroidManifest.xml, which looks like this:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10502" android:versionName="1.5.2" package="com.ionicframework.vovocooksv7862011" xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
    <application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
        <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_stat_ic_notification" />
        <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/colorAccent" />
        <meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="@string/default_notification_channel_id" />
        <activity android:label="@string/app_name" android:launchMode="singleTop" android:name="com.google.firebase.quickstart.fcm.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <provider android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true" android:name="android.support.v4.content.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" />
        </provider>
        <receiver android:name="cordova.plugins.Diagnostic$LocationProviderChangedReceiver">
            <intent-filter>
                <action android:name="android.location.PROVIDERS_CHANGED" />
            </intent-filter>
        </receiver>
        <receiver android:name="cordova.plugins.Diagnostic$NFCStateChangedReceiver">
            <intent-filter>
                <action android:name="android.nfc.action.ADAPTER_STATE_CHANGED" />
            </intent-filter>
        </receiver>
        <provider android:authorities="${applicationId}.sharing.provider" android:exported="false" android:grantUriPermissions="true" android:name="nl.xservices.plugins.FileProvider">
            <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/sharing_paths" />
        </provider>
        <activity android:exported="true" android:name="com.adobe.phonegap.push.PushHandlerActivity" android:permission="${applicationId}.permission.PushHandlerActivity" />
        <receiver android:name="com.adobe.phonegap.push.BackgroundActionButtonHandler" />
        <receiver android:name="com.adobe.phonegap.push.PushDismissedHandler" />
        <service android:name="com.adobe.phonegap.push.FCMService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <service android:name="com.adobe.phonegap.push.PushInstanceIDListenerService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>
        <service android:name=".MyFirebaseMessagingService">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
        <service android:name=".MyFirebaseInstanceIDService">
            <intent-filter>
                <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
            </intent-filter>
        </service>
        <service android:exported="false" android:name=".MyJobService">
            <intent-filter>
                <action android:name="com.firebase.jobdispatcher.ACTION_EXECUTE" />
            </intent-filter>
        </service>
    </application>
    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="25" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <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" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.VIBRATE" />
</manifest>

I have already looked in forums and even the FCM documentation, but I can not solve it. How can I resolve?

    
asked by anonymous 03.10.2017 / 15:44

2 answers

1

You should be using multiple Android SDKs versions.

Add this to the end of the file build.gradle

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '26.0.2'
            }
        }
    }
}

Another option

Change in AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ionicframework.vovocooksv7862011"
    xmlns:tools="http://schemas.android.com/tools">

And add in the application tag

tools:replace="android:value"
    
03.10.2017 / 15:54
0

I resolved, in addition to what was mentioned by @ Wéllingthon M. de Souza, I changed the values that were like "null" in:

apply from: 'CordovaLib/cordova.gradle'
    // The value for android.compileSdkVersion.
    if (!project.hasProperty('cdvCompileSdkVersion')) {
        cdvCompileSdkVersion = 23;
    }
    // The value for android.buildToolsVersion.
    if (!project.hasProperty('cdvBuildToolsVersion')) {
        cdvBuildToolsVersion = "23.0.2";
    }

And also added as mentioned in the tip, but with version 23:

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '23.0.1'
        }
        }
    }
}
    
10.10.2017 / 15:21