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.
This is line 40 of build.gradle btw,
apply plugin: 'com.android.library'
FAILURE: Build failed with an exception.
- Where: Build file '/home/user/Documents/app/platforms/android/CordovaLib/build.gradle' line: 40
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.
For those of you getting this error, it has to do with your gradle configuration. I've installed gradle through package manager and it installed an old version,
which I asumed it was fine. At least v4.1 of gradle is required to work properly with the latest cordova and android.
Make sure you install the newest gradle from their website: https://gradle.org/install/#manually
Set your gradle PATH properly: $ export PATH=$PATH:/gradle_install_loc/gradle-4.7/bin
Also make sure you're running the correct gradle version in your .properties and .gradle files in your
project folder:
/app_name/platforms/android/gradle/wrapper/gradle-wrapper.properties
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With