I am trying to create the plugin for the following sdk - https://ktplayhelp.zendesk.com/hc/en-us/articles/221071888-Android
In the setup project configuration point it is telling to setup the sdk by importing module in Android studio and add the dependency in our application's build.gradle file.
Can anyone please help and tell me how can I import the Android native module in Cordova without using Android studio?
As you can't modify cordovas .gradle
file you have to add your own and reference it in your plugin.xml
you can do that like this:
<framework src="src/android/*.gradle" custom="true" type="gradleReference" />
This will allow you to do things like compiling an external module. To make this actually work you will have to create an .aar
library out of the project you want to integrate.
The resulting gradle-extension will look something like this:
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
dependencies {
compile(name:'KTplay', ext:'aar')
}
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
This assumes that you have put your .aar
library in a subdirectory of your plugin named libs
. Whats left to do is to ensure that the library actually gets copied during the build process, this is why we have to add it as a resource file in plugin.xml
:
<resource-file src="libs/KTplay.aar" target="libs/KTplay.aar" />