title: How to import an android aar library in a cordova plugin
body: <p>I am building a cordova plugin (wrapper) for an existing premium mobile SDK</p>
  
  <p>I have started with Android, based on various tutorials available at the moment</p>
  
  <p>So far, I've successfully set up the local cordova plugin project and the cordova test app and I test the js binding between the cordova app and my dummy java plugin wrapper implementation</p>
  
  <p>Moving forward, I have to add multiple aar dependencies in the plugin, which I expect shall be automatically configured in the cordova android app's gradle build scripts when adding the plug-in with 'cordova plugin add /path/to/my/local/plugin'</p>
  
  <p>However, in practice, it seems I have not found the right way to do so, and all the answers and instructions related to the matter required manual edit of the build.gradle file</p>
  
  <p>As shown in the <a href="https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#source-file" rel="nofollow noreferrer">crodova dependencies configuration documentation</a>, in my plugin.xml file, I've added:</p>
  
  <pre><code> &lt;platform name="android"&gt;
       ......
       &lt;source-file framework="true" 
                    src="native-libs/android/myNativeLib.aar"
                    target-dir="libs"/&gt;
   &lt;/platform&gt;
  </code></pre>
  
  <p>My expectancy was that, on top of copying the .aar file in the target /libs directory, the setting of the attribute 'framework=true' would also result in 'cordova plugin add /path/to/local/plugin/' automatically generating the boilerplate build.gradle configs: </p>
  
  <p>Enable local dependencies repository</p>
  
  <pre><code>repositories {
      ...
      flatDir {
          dirs 'libs'
      }
  }
  </code></pre>
  
  <p>As well as configuring the prescribed aar gradle dependencies</p>
  
  <pre><code>dependencies{
      .....
      compile(name: 'myNativeLib', ext: 'aar')
      .....
  }
  </code></pre>
  
  <p>The thing is, the whole purpose of writing the plugin is for it to work as-is, like any premium integration experience - without any other special set-up instructions</p>
  
  <p>I am really curious if this is currently possible with cordova, or eventually I could attempt to contribute to the project with such a new feature</p>
  
  <p>Looking forward to learning more about this</p>