Unable to run Ionic app after update to Android Studio 3.0

If you are using Cordova build.gradle is automatically generated and when you next build the project the change in accepted answer above get overwritten back to the old that doesn't work.

So edit platforms/android/cordova/lib/builder/GradleBuiler.js Comment out lines 136-139 and add the next line

/*depsList += '    debugCompile(project(path: "' + libName + '", configuration: "debug"))';
insertExclude(p);
depsList += '    releaseCompile(project(path: "' + libName + '", configuration: "release"))';
insertExclude(p);
    */
    depsList += "    compile project(':CordovaLib')";
    insertExclude(p);

I commented the lines below in the build.gradle file:

//debugCompile project(path: 'CordovaLib', configuration: 'debug') 

//releaseCompile project(path: 'CordovaLib', configuration: 'release')

and added:

compile project(':CordovaLib')

This worked for me.