1
votes

When I do adb devices -l I could see my Oneplus in the list.

Doing ionic cordova run android doesn’t open my app on my phone. I also tried doing ionic cordova --device=<device_address> but that didn’t work also.

I also noticed that doing ionic cordova build android didn’t make an apk that I could copy and past over to my device so that I could manually install it.

Tried ionic cordova emulate android that also didn’t work,

Here's a result when running ionic cordova run android --device

ionic cordova run android --device
Running app-scripts build: --platform android --target cordova
[11:48:13]  build dev started ... 
[11:48:14]  clean started ... 
[11:48:14]  clean finished in 35 ms 
[11:48:14]  copy started ... 
[11:48:14]  deeplinks started ... 
[11:48:14]  deeplinks finished in 517 ms 
[11:48:14]  transpile started ... 
[11:48:44]  transpile finished in 29.49 s 
[11:48:44]  preprocess started ... 
[11:48:44]  preprocess finished in 6 ms 
[11:48:44]  webpack started ... 
[11:48:44]  copy finished in 30.59 s 
[11:49:06]  webpack finished in 22.04 s 
[11:49:06]  sass started ... 
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[11:49:09]  sass finished in 2.65 s 
[11:49:09]  postprocess started ... 
[11:49:09]  postprocess finished in 61 ms 
[11:49:09]  lint started ... 
[11:49:09]  build dev finished in 55.30 s 
> cordova run android --device
Android Studio project detected

ANDROID_HOME=/usr/local/Caskroom/android-platform-tools/latest
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
studio

[OK] Your app has been deployed.
     Did you know you can live-reload changes from your app with --livereload?

[11:49:23]  lint finished in 14.23 s

I also tried adding the --livereload flag and entered the External URL on my Chrome App. I was getting these messages when visiting the url:

Result on Terminal:

Development server running!
     Local: http://localhost:8100
     External: http://192.168.1.58:8100

Messages:

gap_init:3
gap:[null,"CoreAndroid","messageChannel","CoreAndroid1311606310"]
gap:[null,"CoreAndroid","show","CoreAndroid1311606311"]
gap:[null,"Device","getDeviceInfo","Device1311606312"]
gap:[null,"Keyboard","init","Keyboard1311606313"]

Any idea on how to get this running?

1
Might I politely also suggest your question title can be tweaked to not say "build/emulate" as you are really talking about just "run" in this case.Greg Netland

1 Answers

0
votes

This may not solve your exact problem, but this worked for me.
I was having the exact same issue and I changed android phones from a Pixel XL running 8.1 to a Samsung S7 running android 7 and it worked.

To solve my Pixel 8.1 problem:

  1. cordova platform list (verify which version you have)
  2. cordova platform rm android (if you dont have 7.1.0)
  3. cordova platform add [email protected]

I then had to make sure my minSDKversion was 19 in my config.xml

This might also help - ionic add platform android with custom android-target