Ionic cordova运行/构建/模拟android无法正常工作

时间:2018-02-25 00:53:46

标签: android cordova ionic-framework

当我这样做的时候 adb devices -l我可以在列表中看到我的Oneplus。

做离子cordova运行android不会在我的手机上打开我的应用程序。 我也尝试过ionic cordova --device=<device_address>,但这也不起作用。

我还注意到做了离子cordova构建android没有制作我可以复制并经过我的设备的apk,以便我可以手动安装它。

尝试过离子cordova模拟android也无效,

这是运行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

我还尝试添加--livereload标记,并在Chrome应用中输入外部网址。我在访问网址时收到了这些消息:

终端上的结果:

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

消息:

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

关于如何运行的任何想法?

1 个答案:

答案 0 :(得分:0)

这可能无法解决您的确切问题,但这对我有用 我遇到了完全相同的问题,我将Android手机从运行8.1的Pixel XL改为运行android 7的三星S7,并且运行良好。

解决我的Pixel 8.1问题:

  1. cordova平台列表(验证您拥有的版本)
  2. cordova平台rm android(如果你没有7.1.0)
  3. cordova平台添加android@7.1.0
  4. 然后我必须确保我的config.xml中的minSDKversion是19

    这也可能会有所帮助 - ionic add platform android with custom android-target