Sky Kelsey
Sky Kelsey

Reputation: 19280

Cordova plugin with v7-appcompat dependency

I'm trying to add a dependency to the android support v7 appcompat library to my Cordova plugin. I've tried many ways of doing this, but nothing seems to do the trick. I'm really surprised that I haven't been able to find a tutorial for this on the Cordova website or anywhere for that matter.

Upvotes: 1

Views: 1728

Answers (2)

Sky Kelsey
Sky Kelsey

Reputation: 19280

It turns out there was a very simple solution to this problem. Previously, I had checked the contents of my Android Library Project directly my Cordova Plugin. My Cordova Plugin is really just a wrapper for iOS and Android with a native bridge class for each.

What I had tried to do was add the appcompat-v7 dependency to my plugin.xml. That didn't work.

But because I distribute my Android Library Project as an .aar on central maven, I was able to modify my plugin.xml to simply include that file as a framework. Since my .aar had dependencies to appcompat-v7 and other libraries specified in the accompanying pom.xml, the normal Cordova build process worked perfectly.

<platform name="android">
    <!--
      Your other plugin configuration options would go here.
    -->
    <framework src="com.your.package:your-artifact:1.0.0"/>
    <source-file src="src/android/YourBridge.java" target-dir="src/com/your/package/cordova"/>
</platform>

Upvotes: 1

user3255670
user3255670

Reputation:

@Sky,
I think you are asking for for SDK 7 compatibility. If so, then you need to add to your config.xml the following line:

<preference name="android-minSdkVersion" value="7" />

This article will have more details. PhoneGap 3.0 – Stuff You Should Know
http://devgirl.org/2013/09/05/phonegap-3-0-stuff-you-should-know/

You can also Google: phonegap CLI minSdkVersion

If not, then please respond.

Lastly, you might consider reading this:
Top Mistakes by Developers new to Cordova/Phonegap

Jesse

Upvotes: 0

Related Questions