Error when trying to run on android device

Hi, I usually test my app with ‘Ionic lab’ command. But now it has come to test the app on a real device. I thought it would be straight forward so I ran this command ‘ionic cordova run android --device’…

However I am getting the following error…

Please help!

I’ve read somewhere else that it could be related to the splash and icon images in the resources folder… so I’ve tried deleting them and pasting other ones in from another project, but with no result.

Thanks,
Brian

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems - you want CLI 8.0.0 and Android 7.1.x.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: https://ionic.zone/cordova/update

Then also make ionic cordova requirements happy and try again.

Hi Sujan,

Thanks for your reply. It seems that I am still getting the error even after updating (maybe incorrectly).

Please help…

You should also update your Cordova CLI to 8.0.0 - but this will maybe also not fix your problem. It is just a precondition for being able to debug your problem.

Do you get the same error when you create a new project with ionic start and build that one?

How do I update to version 8.0.0 (sorry for a stupid question)…

I’ve ran the command ‘npm update -g cordova’ but I am still getting this version…
image

Thanks

I have tried creating a new empty project and running the command on that to test it on my android device… but again I get the same error

1 Like

Ok, try cordova run android --verbose then please.

It seems that gets an error too…

What does cordova requirements return?

Something doesn’t play well with the installed Cordova and the Android tooling…

That returns the following…

Oh, an idea: Try to install a standalone Gradle from gradle.org/install

I’m not too sure what you mean Sujan, sorry I am just a beginner so everything is new to me.

Go to that URL, download the most recent version under the “Install manually” headline, install it, run ionic cordova requirements again.

Thanks for talking me through it… I’ve now got that downloaded correctly.

image

and this is what I get with ‘ionic cordova requirements’…

I don’t think the gradle is pointing to the correct place though.

Thanks

Sorry, don’t know much about that and pretty much out of ideas.

The read error message you posted mentioned a log - maybe search for that.

When I run cordova requirements it seems that under the Gradle heading, it is still pointing to the same place.
Would you know how to make the Gradle heading be pointing to C:\Gradle… where I downloaded that file you said?

Thanks

No. I also don’t know if this is needed or would help in any way.

Do you know of anyone that could help me?

Its really important that I can run the app on my android device as I am using Ionic for my final year project in university.

Thanks

Looking at the logs might give you an indication or something to google with.

Otherwise:

  • Try another computer.
  • Uninstall everything Android Studio, Android SDK, Gradle etc and start new.