I’m getting the following error while trying to run my ionic app for android.
$ ionic cordova run android -l --verbose
> cordova build android --verbose [INFO] ... and 77 additional chunks [ng] ℹ ｢wdm｣: Compiled successfully. No scripts found for hook "before_build". No scripts found for hook "before_prepare". Checking config.xml and package.json for saved platforms that haven't been added to the project Config.xml and package.json platforms are the same. No pkg.json modification. Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms. PlatformApi successfully found for platform android Checking for saved plugins that haven't been added to the project Checking for any plugins added to the project that have not been installed in android platform No differences found between plugins added to project and installed in android platform. Continuing... Generating platform-specific config.xml from defaults for android at /home/nickk/projects/ionic-apps/upTeamWork/platforms/android/app/src/main/res/xml/config.xml Merging project's config.xml into platform-specific android config.xml [Gradle Properties] Preparing Configuration [Gradle Properties] Appending default configuration properties [Gradle Properties] Appending custom configuration properties [Gradle Properties] Updating and Saving File Merging and updating files from [www, platforms/android/platform_www] to platforms/android/app/src/main/assets/www Wrote out android application name "MyApp" to /home/nickk/projects/ionic-apps/upTeamWork/platforms/android/app/src/main/res/values/strings.xml android-versionCode not found in config.xml. Generating a code based on version in config.xml (0.0.1): 1 Wrote out Android package name "463644564c483098" to /home/nickk/projects/ionic-apps/upTeamWork/platforms/android/app/src/main/java/463644564c483098/MainActivity.java Updating icons at platforms/android/app/src/main/res Updating splash screens at platforms/android/app/src/main/res Updating resource files at platforms/android Prepared android project successfully No scripts found for hook "after_prepare". No scripts found for hook "before_compile". Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=/home/nickk/Android/Sdk (recommended setting) ANDROID_HOME=/usr/lib/android-sdk (DEPRECATED) Requirements check failed for JDK 8 ('1.8.*')! Detected version: 11.0.7 Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables. CordovaError: Requirements check failed for JDK 8 ('1.8.*')! Detected version: 11.0.7 Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables. at /home/nickk/projects/ionic-apps/upTeamWork/platforms/android/cordova/lib/check_reqs.js:371:19 at _fulfilled (/home/nickk/projects/ionic-apps/upTeamWork/platforms/android/cordova/node_modules/q/q.js:854:54) at /home/nickk/projects/ionic-apps/upTeamWork/platforms/android/cordova/node_modules/q/q.js:883:30 at Promise.promise.promiseDispatch (/home/nickk/projects/ionic-apps/upTeamWork/platforms/android/cordova/node_modules/q/q.js:816:13) at /home/nickk/projects/ionic-apps/upTeamWork/platforms/android/cordova/node_modules/q/q.js:624:44 at runSingle (/home/nickk/projects/ionic-apps/upTeamWork/platforms/android/cordova/node_modules/q/q.js:137:13) at flush (/home/nickk/projects/ionic-apps/upTeamWork/platforms/android/cordova/node_modules/q/q.js:125:13) at processTicksAndRejections (internal/process/task_queues.js:79:11) [ERROR] An error occurred while running subprocess cordova. cordova build android --verbose exited with exit code 1. Re-running this command with the --verbose flag may provide more information. ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms ionic:utils-process onBeforeExit handler: running 4 functions +0ms ionic:lib:hooks Looking for ionic:serve:after npm script. +17s ionic:utils-process processExit: exiting (exit code: 1) +31ms
Run code snippet
The thing is, I already set the variable JAVA_HOME with the “best version” as it follows,
$ sudo update-alternatives --display java
java - auto mode link best version is /usr/lib/jvm/java-11-openjdk-amd64/bin/java link currently points to /usr/lib/jvm/java-11-openjdk-amd64/bin/java link java is /usr/bin/java slave java.1.gz is /usr/share/man/man1/java.1.gz /usr/lib/jvm/java-11-openjdk-amd64/bin/java - priority 1111 slave java.1.gz: /usr/lib/jvm/java-11-openjdk-amd64/man/man1/java.1.gz /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1081 slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz
Run code snippet
I’m not sure why I’m getting this error(since I already config the JAVA_HOME var), I tried many things and none of them worked, thanks in advance.