[SOLVED] Ionic run android - com.android.support conflicting v26-alpha1 and v25.3.1

Hello,

Exact same code ran yesterday well with ionic run android but with errors below today.

I googled and it seems that the gradle command encountered com.android.support conflicting v26-alpha1 and v25.3.1. But I am too rookie to know where to resolve.

Thanks for any help!

Br

Execution failed for task ':processArmv7DebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31
        is also present at [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1).
        Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:34 to override.
system information:
Cordova CLI: 7.0.1                                                                                                                                                                                                 
Ionic Framework Version: 3.2.1                                                                                                                                                                                     
Ionic CLI Version: 2.2.3                                                                                                                                                                                           
Ionic App Lib Version: 2.2.1                                                                                                                                                                                       
Ionic App Scripts Version: 1.3.7                                                                                                                                                                                   
ios-deploy version: Not installed                                                                                                                                                                                  
ios-sim version: Not installed                                                                                                                                                                                     
OS: Linux 4.10                                                                                                                                                                                                     
Node Version: v6.10.3                                                                                                                                                                                              
Xcode version: Not installed    
2 Likes

I would start with removing the Android platform and re-adding it.
Also see that Android SDK and all connecting tools are updated (using Android Studio if installed).

If this doesn’t help please post your ionic info output, package.json content, cordova requirements output and ionic cordova platform list output.

Problem solved!!

Thanks to ionic forum thread “how to ask question” and I used the googling skill to find out this => https://stackoverflow.com/questions/42949974/android-support-repo-46-0-0-with-android-studio-2-3

Then, I somehow realize that the build.gradle file exists in project-folder/platforms/android. So I added this code snippet to end of the gradle file. It worked magically!

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'
            }
        }
    }
}
42 Likes

I have the error today. Does someone know how this happen and what is the reason of the error?

1 Like

chek the stackoverflow thread I put above…

OMG…this actually worked…
Amazingo…!!

It worked perfectly for me as well! Thank you so much!:heart_eyes:

danielle113 solution absolutely worked… Simple copy and paste. Gotta love it.

Of course this worked very well. It would be very helpful however to provide an explanation of what is going on here.

Just gonna let that here:

If you face this issue means that you are using one plugin which are too permissive in the specification of their dependencies. Grep your plugin and try to find references like ‘support-v4:+’ these should be improved to specify a specific library deps

You could find more information about that subject in the following issue (which actually mix a lot of different plugins):

In my case I had a conflict with cordova-diagnostic-plugin which was improved in v3.6.5 of the plugin, see changelog:

4 Likes

its work for me!!
thanks!!:grinning:

danielle113 that made the job done. Thank you

Same issue after adding plugin com-darryncampbell-cordova-plugin-intent, your solution works perfect :slight_smile: @danielle113

Thanks for the answer - works perfectly however, build.gradle is built dynamically every time you build the app so if you add anything in there it gets lost. To get round this create a build-extras.gradle file and the above code in there wrapped in ext.postBuildExtras. Keep this file in your root app folder so you can copy it into the platforms/android folder.

build-extras.gradle
ext.postBuildExtras = {
	android {
		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'
					}
				}
			}
		}
	}
}
3 Likes

You can install the following plugin to solve this issue : https://github.com/dpa99c/cordova-android-support-gradle-release

9 Likes

Thank you very much! This finally got the Geofence plugin to Android. Now to look for some solution for iOS…

1 Like

Execution failed for task ‘:processArmv7DebugResources’.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

After adding that part of code to my build.gradle, the above error showed up.
Do you know what I can do to fix it ?

thanks you very much. It is really working…

Same error here and don’t run yours options :frowning:

…\platforms\android\AndroidManifest.xml:21:59-81 Error:
Attribute meta-data#android.support.VERSION@value value=(26.1.0) from AndroidManifest.xml:21:59-81
is also present at [com.android.support:appcompat-v7:25.4.0] AndroidManifest.xml:28:13-35 value=(25.4.0).
Suggestion: add ‘tools:replace=“android:value”’ to element at AndroidManifest.xml:21:9-84 to override.

thank you so much…works fine now