简体   繁体   English

离子科尔多瓦运行/构建/模拟Android无法正常工作

[英]Ionic cordova run/build/emulate android not working

When I do adb devices -l I could see my Oneplus in the list. 当我使用adb devices -l我可以在列表中看到我的Oneplus。

Doing ionic cordova run android doesn't open my app on my phone. 使用离子cordova运行android无法在手机上打开我的应用程序。 I also tried doing ionic cordova --device=<device_address> but that didn't work also. 我也尝试过做ionic cordova --device=<device_address>但是那也不起作用。

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. 我还注意到,使用ionic cordova构建android系统并没有使我可以复制并粘贴到设备上的apk,以便可以手动安装它。

Tried ionic cordova emulate android that also didn't work, 尝试过的离子科尔多瓦模拟android也不起作用,

Here's a result when running ionic cordova run android --device 这是运行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. 我还尝试添加--livereload标志,并在Chrome应用中输入了外部URL。 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? 关于如何使它运行的任何想法?

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. 我遇到了完全相同的问题,我将android手机从运行8.1的Pixel XL更改为运行android 7的Samsung S7,并且运行正常。

To solve my Pixel 8.1 problem: 解决我的Pixel 8.1问题:

  1. cordova platform list (verify which version you have) cordova平台列表(验证您拥有的版本)
  2. cordova platform rm android (if you dont have 7.1.0) 科尔多瓦平台rm android(如果您没有7.1.0)
  3. cordova platform add android@7.1.0 科尔多瓦平台添加android@7.1.0

I then had to make sure my minSDKversion was 19 in my config.xml 然后,我必须确保config.xml中的minSDKversion为19

This might also help - ionic add platform android with custom android-target 这也可能有帮助- 离子添加带有自定义android-target的android系统

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM