Ionic5 - ionic cordova run android is not working for me

I created a new ionic 5 app, & am trying to run it on my android device.

I installed this platform: ionic cordova platform add android:6.4, & then ran ionic cordova run android.

But I get this error message:

myErr

Also, here are my system variables:

![vara|690x381](upload://zXj0gqcSf3zTr8mZwLOZUk30hl1.png) 

Can someone please tell me what is causing this issue, & how can I resolve it?

Can you run this command and paste the entire output here?

ionic cordova platform add android --verbose
and
ionic cordova run android --verbose

Hi Matt,

Thanks for replying to this.

I’ve made some changes since posting, & am getting a different error now relating to gradle.

I created a basic android app & ran it in android studio just to make sure it compiles, & the app was displaying on my phone, so I’m not sure if that helps.

I ran your command. but can’t paste in the entire console, so I’ve added what I think is useful below:

Wrote out android application name "MyApp" to C:\Users\damie\Documents\Ionic\Feedly\platforms\android\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 "io.ionic.starter" to C:\Users\damie\Documents\Ionic\Feedly\platforms\android\src\io\ionic\starter\MainActivity.java
Updating icons at platforms\android\res
Updating splash screens at platforms\android\res
Updating resource files at platforms\android
Prepared android project successfully
config file app/src/main/AndroidManifest.xml requested for changes not found at C:\Users\damie\Documents\Ionic\Feedly\platforms\android\app\src\main\AndroidManifest.xml, ignoring
config file app/src/main/AndroidManifest.xml requested for changes not found at C:\Users\damie\Documents\Ionic\Feedly\platforms\android\app\src\main\AndroidManifest.xml, ignoring
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
ANDROID_HOME=C:\Users\damie\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_241
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
CordovaError: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
    at Object.module.exports.check_gradle (C:\Users\damie\Documents\Ionic\Feedly\platforms\android\cordova\lib\check_reqs.js:150:18)      
    at GradleBuilder.prepEnv (C:\Users\damie\Documents\Ionic\Feedly\platforms\android\cordova\lib\builders\GradleBuilder.js:174:23)       
    at Api.module.exports.run (C:\Users\damie\Documents\Ionic\Feedly\platforms\android\cordova\lib\build.js:146:20)
    at C:\Users\damie\Documents\Ionic\Feedly\platforms\android\cordova\Api.js:335:43
    at _fulfilled (C:\Users\damie\Documents\Ionic\Feedly\platforms\android\cordova\node_modules\q\q.js:854:54)
    at C:\Users\damie\Documents\Ionic\Feedly\platforms\android\cordova\node_modules\q\q.js:883:30
    at Promise.promise.promiseDispatch (C:\Users\damie\Documents\Ionic\Feedly\platforms\android\cordova\node_modules\q\q.js:816:13)       
    at C:\Users\damie\Documents\Ionic\Feedly\platforms\android\cordova\node_modules\q\q.js:624:44
    at runSingle (C:\Users\damie\Documents\Ionic\Feedly\platforms\android\cordova\node_modules\q\q.js:137:13)
    at flush (C:\Users\damie\Documents\Ionic\Feedly\platforms\android\cordova\node_modules\q\q.js:125:13)
[ERROR] An error occurred while running subprocess cordova.

        cordova.cmd 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 2 functions +15ms
  ionic:utils-process error while killing process tree for 576: Error: Command failed: taskkill /pid 576 /T /F
  ionic:utils-process ERROR: The process "576" not found.
  ionic:utils-process 
  ionic:utils-process     at ChildProcess.exithandler (child_process.js:303:12)
  ionic:utils-process     at ChildProcess.emit (events.js:311:20)
  ionic:utils-process     at maybeClose (internal/child_process.js:1021:16)
  ionic:utils-process     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
  ionic:utils-process   killed: false,
  ionic:utils-process   code: 128,
  ionic:utils-process   signal: null,
  ionic:utils-process   cmd: 'taskkill /pid 576 /T /F'
  ionic:utils-process } +143ms
  ionic:utils-process onBeforeExit handler: error from function: Error: Command failed: taskkill /pid 576 /T /F
  ionic:utils-process ERROR: The process "576" not found.
  ionic:utils-process 
  ionic:utils-process     at ChildProcess.exithandler (child_process.js:303:12)
  ionic:utils-process     at ChildProcess.emit (events.js:311:20)
  ionic:utils-process     at maybeClose (internal/child_process.js:1021:16)
  ionic:utils-process     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
  ionic:utils-process   killed: false,
  ionic:utils-process   code: 128,
  ionic:utils-process   signal: null,
  ionic:utils-process   cmd: 'taskkill /pid 576 /T /F'
  ionic:utils-process } +35ms
  ionic:utils-process error while killing process tree for 7276: Error: Command failed: taskkill /pid 7276 /T /F
  ionic:utils-process ERROR: The process "7276" not found.
  ionic:utils-process 
  ionic:utils-process     at ChildProcess.exithandler (child_process.js:303:12)
  ionic:utils-process     at ChildProcess.emit (events.js:311:20)
  ionic:utils-process     at maybeClose (internal/child_process.js:1021:16)
  ionic:utils-process     at Socket.<anonymous> (internal/child_process.js:443:11)
  ionic:utils-process     at Socket.emit (events.js:311:20)
  ionic:utils-process     at Pipe.<anonymous> (net.js:668:12) {
  ionic:utils-process   killed: false,
  ionic:utils-process   code: 128,
  ionic:utils-process   signal: null,
  ionic:utils-process   cmd: 'taskkill /pid 7276 /T /F'
  ionic:utils-process } +7ms
  ionic:utils-process onBeforeExit handler: error from function: Error: Command failed: taskkill /pid 7276 /T /F
  ionic:utils-process ERROR: The process "7276" not found.
  ionic:utils-process 
  ionic:utils-process     at ChildProcess.exithandler (child_process.js:303:12)
  ionic:utils-process     at ChildProcess.emit (events.js:311:20)
  ionic:utils-process     at maybeClose (internal/child_process.js:1021:16)
  ionic:utils-process     at Socket.<anonymous> (internal/child_process.js:443:11)
  ionic:utils-process     at Socket.emit (events.js:311:20)
  ionic:utils-process     at Pipe.<anonymous> (net.js:668:12) {
  ionic:utils-process   killed: false,
  ionic:utils-process   code: 128,
  ionic:utils-process   signal: null,
  ionic:utils-process   cmd: 'taskkill /pid 7276 /T /F'
  ionic:utils-process } +27ms
  ionic:utils-process processExit: exiting (exit code: 1) +42ms

You might want to google this error message

CordovaError: Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper. Please include gradle in your path, or install Android Studio

I’ve found this issue on the Ionic Github, maybe it can help you sort out your problem.
Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper. Please include gradle in your path, or install Android Studio · Issue #11591 · ionic-team/ionic-framework · GitHub

It’s weird that it happens even when you’ve already installed Android Studio, but hey, it wouldn’t be fun if it didn’t work the first time :slight_smile:

1 . try jdk version 8 becaue this version is compatable
2. set java path without bin