cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maffett, Ian" <>
Subject Re: Cordova 5 - Android and 3rd party libraries question
Date Thu, 21 May 2015 13:19:32 GMT
Thanks for the info Andrew.  I did confirm I was able to build with your
plugin fine.  It looks like that was a red herring on my end.

I¹ve pushed up a github repo showing the DEX issue.  You should be able to
clone it and
run cordova commands.  This does have the fix to generate the proper
settings.gradle file.

One thing to note -

If I do not have compile in there, then I get reference errors trying to
build.  I think
this is causing the DEX issue since the main build.gradle is building


On 5/19/15, 8:05 PM, "Andrew Grieve" <> wrote:

>Hmm, I've written a couple of other plugins that don't suffer from
>dex exceptions. I forget the first, but the second is:
>So, I think there might be something else going on besides the plugin's
>having a dependency on CordovaLib (this is what allows plugin library
>projects to reference Cordova APIs)
>On Mon, May 18, 2015 at 9:18 AM, Maffett, Ian <>
>> I¹ve run into a few issues with Cordova CLI5, Android 4 and
>> libraries/frameworks.  I will try to explain below, but the issue
>> to be related to the dependency section in build.gradle and each
>> build.gradle file.
>> We¹ve developed a plugin to enable expansion files on Android.  It is
>> dependent on three custom Android libraries, which declare in the
>> plugin.xml file.
>> <framework src="AndroidLibrary/GoogleExtras/play_licensing/library"
>> custom="true" />
>> <framework
>> src="AndroidLibrary/GoogleExtras/play_apk_expansion/downloader_library"
>> custom="true"/>
>> <framework src="AndroidLibrary/GoogleExtras/play_apk_expansion/zip_file"
>> custom="true" />¹
>> The first problem we ran into we will be submitting a patch to fix.  The
>> issue is that the project¹s folder name was prepended to the path when
>> was created. We could not reference this in the build-extras.gradle due
>> the constant name change.  Below is an example where my project¹s
>> from cordova create is ³foobar"
>> org.apache.cordova.xapkreader/foobar-library
>> I spoke with Andrew Grieve via email and he recommend changing the
>> build.js file in cordova-android to enable the following in creating the
>> settings.gradle .  We can now properly reference the library in a
>> build-extras.gradle
>> include ":org.apache.cordova.xapkreader:library"
>> project(":org.apache.cordova.xapkreader:library").projectDir = new
>> File("org.apache.cordova.xapkreader/foobar-library²)
>> The second issue we are running into is bigger.  Whenever we run a
>> we get DEX errors.  There are two specific cases we are running into.
>> first is for general Cordova errors, the second is specific to our
>> AndroidLibrary/GoogleExtras/play_licensing/library .
>> Multiple dex files define
>> I believe this is due to the following
>>   1.  The main build.gradle has dependencies to all the sub
>> projects/libraries which get built
>>   2.  The libraries each have their own build.gradle which has a
>> dependency on CordovaLib
>> In the general case, it appears that with each library CordovaLib is
>> compiled into the jar and causes the error for DEX since it includes
>> multiple definitions.  If I open up Android studio and change each
>> libraries build.gradle dependency to only have the following (the
>> to CordovaLib was removed)
>> dependencies {
>>     compile fileTree(dir: 'libs', include: '*.jar')
>> }
>> This removes the DEX errors for Cordova.   The issue specific to our
>> plugin is that I have to modify the main build.gradle dependency to
>> the references for the following, which is a custom library we¹ve
>> debugCompile project(path: ":org.apache.cordova.xapkreader:library",
>> configuration: "debug")
>> releaseCompile project(path: ":org.apache.cordova.xapkreader:library",
>> configuration: "release")
>> Removing those references allows the
>> AndroidLibrary/GoogleExtras/play_apk_expansion/downloader_library
>> build-extras.gradle file to reference it and build successfully.
>> dependencies {
>>     compile(project(':org.apache.cordova.xapkreader:library'))
>>     compile fileTree(dir: 'libs', include: '*.jar')
>>  }
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message