title: Ionic android build failing 'CordovaLib'
body: <p>I've searched everywhere and there's no info regarding this error.
  I have android studio, tried several sdk's, same error. The environment variables have also been set up properly.</p>
  
  <p>This is line 40 of build.gradle btw,
  <code>apply plugin: 'com.android.library'</code></p>
  
  <blockquote>
    <p>FAILURE: Build failed with an exception.</p>
    
    <ul>
    <li>Where: Build file '/home/user/Documents/app/platforms/android/CordovaLib/build.gradle'
    line: 40</li>
    </ul>
  </blockquote>
  
  <pre><code>A problem occurred evaluating project ':CordovaLib'.
  org.gradle.api.Project.getPluginManager()Lorg/gradle/api/plugins/PluginManager;
  
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
          at ChildProcess.whenDone (/home/user/app/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
          at ChildProcess.emit (events.js:182:13)
          at maybeClose (internal/child_process.js:947:16)
          at Process.ChildProcess._handle.onexit (internal/child_process.js:236:5)
      (node:2259) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
      (node:2259) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  </code></pre>