Cordova-plugin-local-notifications: Fix compatibility w/ other plugins due to android-support-v4.jar

Created on 20 Jul 2015  路  13Comments  路  Source: katzer/cordova-plugin-local-notifications

In order to work w/ other plugins which uses android-support-v4 as well such as Facebook and Push Notifications it is recommended to replace

 <lib-file src="libs/android/android-support-v4.jar" />

with

<framework src="com.android.support:support-v4:+" />

For more details:
https://github.com/phonegap-build/PushPlugin/issues/492

duplicate android

Most helpful comment

Hi, just extending @sgrebnov comment, I had the plugin installed and my app was not compiling on android for exactly this problem. The solution was
1) remove the plugin

ionic plugin rm de.appplant.cordova.plugin.local-notification

2) add the plugin again

ionic plugin add https://github.com/katzer/cordova-plugin-local-notifications.git

3) Go to /project_dir/plugins/de.appplant.cordova.plugin.local-notification/plugin.xml line 136 where you should find

<lib-file src="libs/android/android-support-v4.jar" />

and change it for

<framework src="com.android.support:support-v4:+" />

4) remove Android platform

ionic platform rm android

5) add android again

ionic platform add android

6) Build and it should work now

All 13 comments

i have the same problem, but that doesn't fixed that.
my temporary fix is to delete this line.
are there any better solutions?

+1

Hi, just extending @sgrebnov comment, I had the plugin installed and my app was not compiling on android for exactly this problem. The solution was
1) remove the plugin

ionic plugin rm de.appplant.cordova.plugin.local-notification

2) add the plugin again

ionic plugin add https://github.com/katzer/cordova-plugin-local-notifications.git

3) Go to /project_dir/plugins/de.appplant.cordova.plugin.local-notification/plugin.xml line 136 where you should find

<lib-file src="libs/android/android-support-v4.jar" />

and change it for

<framework src="com.android.support:support-v4:+" />

4) remove Android platform

ionic platform rm android

5) add android again

ionic platform add android

6) Build and it should work now

+1
A proper fix for this should be added to the master.
The above didn't work for me.
But it got me on the right track to allow me to install.

I Already have android-support-v13.jar from another plugin in my android lib, this plugin was adding android-support-v4.jar also which was causing the build to fail due to duplicate classes and such

simply removing the android-support-v4.jar from the android/libs allowed me to build

@Slavrix, which plugin added 'android-support-v13.jar' to libs? - we may want to update it as well (adding such jars to libs folder is a wrong way to deal w/ deps and won't scale moving forward)

com.phonegap.plugins.PushPlugin is where the android-support-v13.jar install came from.

Great - this has been already fixed in master branch (PushPlugin) and will be released as 2.5.0

Thanks ! It solved my problem !

+1 it did the trick for me.

Also
<dependency id="org.apache.cordova.device" />
should be
<dependency id="cordova-plugin-device" />

Will this be fixed for the plugin on build.phonegap.com?

Well, i dont know if i have a newest version of local-notification but in my plugin.xml, line 136 and all file there isnt <lib-file src="libs/android/android-support-v4.jar" /> or any other ".jar", i think, its because now we have dependency of cordova-plugin-android-support-v4, anyway, to make the build work, i've needed to delete android-support-v4.jar from platforms/android/libs.

Thanks all.

Has been fixed in the meantime.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faytekin picture faytekin  路  3Comments

ibnbd picture ibnbd  路  4Comments

daniele-sartiano picture daniele-sartiano  路  4Comments

sharatchandra99 picture sharatchandra99  路  5Comments

makinhs picture makinhs  路  5Comments