Error when trying to run on android device


#1

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


#2

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.


#3

Hi Sujan,

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

Please help…


#4

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?


#5

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


#6

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


#7

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


#8

It seems that gets an error too…


#9

What does cordova requirements return?

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


#10

That returns the following…


#11

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


#12

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


#13

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


#14

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


#15

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.


#16

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


#17

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


#18

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


#19

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.