Ionic build android support library issue

I have a issue when building my ionic project for android this error occurs :

Execution failed for task ‘:processDebugManifest’.

Manifest merger failed : uses-sdk:targetSdkVersion 19 cannot be different than version L declared in library C:~the path to my project~\platforms\android\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.0-rc1\AndroidManifest.xml

I did a little searching and found out that the support library in the \platforms\android\build.gradle file :
instead of

compile “com.android.support:support-v4:+”

should be

compile “com.android.support:support-v4:20.+”

but after doing that and starting the build , it automatically changes to the previous form. So building always fails with this error.

Any insights about this issue? Thanks.

Right after i posted this i tried something and android build went successful.

In C:~path to my project~\platforms\android\project.properties file
i changed

cordova.system.library.1=com.android.support:support-v4:+

to
cordova.system.library.1=com.android.support:support-v4:20.+

But i want to know if this is a permanent solution or have i done something wrong in the past that caused this issue in the first place.

Thanks

Well your platforms folder is supposed to be rebuilt based on what is in your config.xml so I would rather try to find a solution in this file as you know that in cordova you may have to rm and re-add your platforms for some plugin issues.

Have you tried to change target SDK in config.xml?

Thanks for the response, gmarziou.

Yes, i’ve tried changing target SDK for example to 22 and the error says :

Manifest merger failed : uses-sdk:targetSdkVersion 22 cannot be 
different than version L declared in library C:\~the path to my 
project~\platforms\android\build\intermediates\exploded-aar\com.android.support\support-v4\21.0.0-rc1\AndroidManifest.xml

So it’s basically the same error.

Support library comes from the Extras package in the SDK manager, so I would try to download/update it and then remove and re-add android platform in project.

1 Like

It worked, support library must have been out of date.

Thanks a lot, gmarziou.

1 Like