I am a newbie in creating cordova plugin or apps. I have an android native library i.e. an aar file which I need to make a cordova plugin from. I have read many articles about creating such a folder structure as below:
pluginFolder/
build-extras.gradle
plugin.xml
yourDirContainingYourAAR/
src/
android/
yourFile.gradle
myPlugin.java
I followed this answer for folder structure and put all necessary files in respective folders >> Cordova plugin development - adding aar
In the plugin.xml file :
<framework src="src/android/yourFile.gradle" custom="true" type="gradleReference" />
<resource-file src="yourDirContainingYourAAR/mylib.aar" target="libs/mylib.aar" />
In the gradle file yourFile.gradle :
repositories{
jcenter()
flatDir {
dirs 'libs'
}
}
dependencies {
compile(name:'mylib', ext:'aar')
}
android {
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
build-extras.gradle :
android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
I created folder structure for cordova app using cordova CLI tool and opened the app in Android Studio. I tried making the above folder structure for plugin as it is in Android Studio, but the problem is my gradle files are not getting synced because of that I am not able to access APIs of my aar.