Skip to content Skip to sidebar Skip to footer

How Do I Properly Include An External Jar File For A Cordova Plugin?

I am trying to make a simple cordova android plugin that requires classes defined in a jar file. I have a test project here, that includes the example usage & a simplified vers

Solution 1:

Your plugin.xml is correct.

Do not edit the plugin.xml after you have added/install the plugin into the project. When you run cordova build or prepare it will not process the native parts of plugin.xml, it only get's process on cordova plugin add

Update your plugin repo/folder with plugin.xml containing the jar file and the line that you have is correct.

Then do

cordova plugin rm

cordova plugin add

cordova build

The end result verify that /platforms/android/libs/pebble_kit.jar is present after cordova build.

Solution 2:

You can also add a jar file with:

<lib-filesrc="src/android/libs/pebble_kit.jar" />

This will add the jar to platforms/android/app/libs/

Post a Comment for "How Do I Properly Include An External Jar File For A Cordova Plugin?"