Ionic with Cordova, Androidmanifest.xml build error

Asked

Viewed 568 times

1

When in my console I give the 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 google.service.Google Messenge FCM Jason, I fixed it, but now it’s in some configuration of my Androidmanifest.xml, which is like this way:

<?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’ve looked in forums and even in the FCM documentation, but I can’t fix it. How can I fix?

2 answers

1


You must be using several versions Sdks of Android.

Add this at 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'
            }
        }
    }
}

Other option

Altere in the 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 to the tag application

tools:replace="android:value"
  • Thank you @Wéllingthon! :)

0

I decided, in addition to what was mentioned by @Wéllingthon M. de Souza, I changed the values that were "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 I 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'
        }
        }
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.