I've been developing an app for 6 months now. I've never tested it on a device, always in browser, but it's gotten to the point where I want to test on my android phone.
So I do ionic cordova run android --device
and I get an error:
Error: Failed to transpile program at BuildError.Error (native) at new BuildError (C:\xampp\htdocs\project x\projectx\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28) at C:\xampp\htdocs\project x\projectx\node_modules\@ionic\app-scripts\dist\transpile.js:159:20 at transpileWorker (C:\xampp\htdocs\project x\projectx\node_modules\@ionic\app-scripts\dist\transpile.js:107:12) at Object.transpile (C:\xampp\htdocs\project x\projectx\node_modules\@ionic\app-scripts\dist\transpile.js:64:12) at C:\xampp\htdocs\project x\projectx\node_modules\@ionic\app-scripts\dist\build.js:109:82 [18:05:02] copy finished in 4.95 s
which I can't seem to fix.
I was curious if it was perhaps a problem with my machine, or phone, or something so I created a new ionic project by doing ionic start ionic-test
and then simply running it again with ionic cordova run android --device
, and this time it worked perfectly. It ran on my device.
So considering that, can I simply paste over my src
files into the new project? or is there something else I can do to get this working? Any ideas/tips? Thanks!
Edit:
Here is a pastebin to the entire result of ionic cordova run android --device
.
https://pastebin.com/x1zX5U1e (note: there were about 200 code warnings from typescript but they were all very minor stuff)
And here is a pastebin for ionic info
https://pastebin.com/A628WpAW
Edit 2: I found the solution. I will be posting a detailed answer soon!
Okay, so I struggled with this for over a month, and I finally realized my issue was actually stupidly simple.
What I found was that even though my application compiled using ionic serve
with the "warnings" it had, the application couldn't be built on a phone without removing those "warnings". I had something like over 40 warnings, and getting rid of them all took a few hours but afterwards ionic cordova run android --device
worked perfectly.
So if you are having this problem: look at the typescript errors you have and fix them. Your problem should be fixed.
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