Question

I'm building a Cordova plugin that needs to be obfuscated before it is imported in the Cordova Android app. Similar to the mpay plugin.

The cordova plugin documentation for Android explains how to write a plugin that gets compiled together with the Android app. However, how should one compile, jar, obfuscate and package a plugin to distribute witout source ?

Was it helpful?

Solution

You isolate the code you want to obfuscate in a jar, and put it with the source code for the Cordova plugin you're creating (under src).

Then you mention the jar in the plugin.xml file with <lib-file src="src/path_to_jar"/> so that Cordova knows it should treat the file as library when packaging the code.

This is how the mpay developers did it. They put the jar here and mentioned it here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top