4

I am having trouble in building my ionic 3 app. Every time I try to build the android app it gives the following error.

* What went wrong:
Execution failed for task ':processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value val
ue=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:2
7:9-31
        is also present at [com.android.support:support-v4:26.0.0-alpha1] Androi
dManifest.xml:27:9-38 value=(26.0.0-alpha1).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element a
t AndroidManifest.xml:25:5-27:34 to override.

My ionic info is as follows:

cli packages: (C:\Users\SystemOne\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.18.0
ionic (Ionic CLI) : 3.18.0

global packages:

cordova (Cordova CLI) : 6.5.0

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.7.1

System:

Node : v6.10.0
npm  : 3.10.10
OS   : Windows 7

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : legacy

Any help would be much appriciated

enter image description here

Shivam
  • 3,091
  • 4
  • 30
  • 45

3 Answers3

6

Your Android build is attempting to support multiple versions, take note of this part: [com.android.support:appcompat-v7:25.3.1] - this is the older version that it is trying to support.

Put this at the end of your app module build.gradle(in your project folder):

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

Make sure to replace the details.useVersion with the older version number.

Shivam
  • 3,091
  • 4
  • 30
  • 45
2

Worked for me:

cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=26.+

Font: https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview/issues/362#issuecomment-366457197

Reynaldo
  • 504
  • 8
  • 13
0

It's a good advice to do

ionic cordova platform rm android
ionic cordova platform add android@7.1.1

after every plugin installation or update.

Hammad Ahmad
  • 184
  • 1
  • 6