From 7d26c51da6c99d735a8462364e896c8cf35112de Mon Sep 17 00:00:00 2001
From: Joe Bowser <bowserj@apache.org>
Date: Thu, 6 Oct 2016 11:41:28 -0700
Subject: [PATCH] CB-11964: Do a clean when installing a plugin to et around
 the bug

---
 bin/templates/cordova/Api.js | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/bin/templates/cordova/Api.js b/bin/templates/cordova/Api.js
index 8885809f..74549fe6 100644
--- a/bin/templates/cordova/Api.js
+++ b/bin/templates/cordova/Api.js
@@ -212,6 +212,11 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
       installOptions.android_studio = true;
     }
 
+    //CB-11964: Do a clean when installing the plugin code to get around
+    //the Gradle bug introduced by the Android Gradle Plugin Version 2.2
+    //TODO: Delete when the next version of Android Gradle plugin comes out
+    
+    this.clean();
     return PluginManager.get(this.platform, this.locations, project)
         .addPlugin(plugin, installOptions)
         .then(function () {