Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using gradleReference feature in cordova plugin.xml

I'm developing a plugin which needs to pull in some additional dependencies. Because I expect the end user to work with Android studio, I am using the gradle build by setting ANDROID_BUILD=gradle.

From what I found, including a gradleReference in the plugin.xml seemed the perfect way to do what I needed. I followed what was done here:

https://github.com/MobileChromeApps/mobile-chrome-apps/blob/master/cordova/cca-hooks-plugin/plugin.xml

including specifying the higher version of plugman, but it doesn't seem to work. The included gradle never seems to be run, and I don't see anything added to the project's build.gradle. I also don't see any errors, however.

I am wondering if this point if the issue is that I am working with released versions of cordova (4.3) and cordova-android (3.7.1) and that possibly I need pre-release versions in order to use gradleReference, but I'm having trouble figuring out exactly what I might need.

My plugin.xml includes:

<framework src="libs/toolkit_library/toolkit.gradle" custom="true" type="gradleReference" />

and this file exists in the plugin with:

dependencies {
    compile group: 'com.xxx', name: 'xxx', version: '0.10.0'
}
like image 581
Nell Gawor Avatar asked Nov 09 '22 17:11

Nell Gawor


1 Answers

It turned out that in Cordova Android 3.7.1 that I was using, the gradle is included via build.properties, not by modifying the original gradle file (even though there is a marker in the original gradle file that says content will be included there).

This also means that the included gradle only runs via the Cordova build, and not in a standard gradle build, since that does not use build.properties. In Cordova Android 4.0 this reportedly will no longer be an issue.

like image 106
Nell Gawor Avatar answered Nov 15 '22 06:11

Nell Gawor