1

I'm trying to figure out how to include LibBlinkID.aar file into the Cordova plugin. So far I have tried this, this, that and other places here, on SO, all to no avail.

First of all, I was trying to figure out the proper build.gradle file that will do a proper build:

    repositories{    
 jcenter()
   flatDir {
     dirs './libs'
   }
}

dependencies {
  compile (
      name:'LibBlinkID',
      ext:'aar')
}

android {
 packagingOptions {
  exclude 'META-INF/NOTICE'
  exclude 'META-INF/LICENSE'
 }
}

But for some reason during compilation it says that compile() is not being found - that is because it shouldn't be in the top-level build.gradle. Okay, where do I put this file into then?

This is the structure of the project:

MyProject
  src
   android
    com
     mynamespace
      FileThatUsesClassesFromLibBlink.java
    libs
     LibBlinkID.aar

And then is the second question - with Gradle version 4.6, how do I make sure LibBlibkID.aar is used?

Daniel Protopopov
  • 6,778
  • 3
  • 23
  • 39

1 Answers1

1

I was trying to figure out the proper build.gradle file that will do a proper build

Not sure what you mean by this, but the Gradle config should go in its own separate Gradle file which is included by the plugin, so you should have something like this:

plugin.xml:

...
<resource-file src="LibBlinkID.aar" target="libs/LibBlinkID.aar" />
<framework src="LibBlinkID.gradle" custom="true" type="gradleReference" />
...

LibBlinkID.gradle:

repositories{    
 jcenter()
   flatDir {
     dirs 'libs'
   }
}

dependencies {
  compile (name:'LibBlinkID', ext:'aar')
}

android {
 packagingOptions {
  exclude 'META-INF/NOTICE'
  exclude 'META-INF/LICENSE'
 }
}

Note that I've changed repositories.flatDir.dirs from ./libs to libs.

DaveAlden
  • 30,083
  • 11
  • 93
  • 155