简体   繁体   English

Ionic / Cordova android模拟损坏-显示一些角度代码

[英]Ionic/cordova android emulate broken - shows some angular code

Newb alert. 纽伯警报。 I'm attempting to build my first ios/android app. 我正在尝试构建我的第一个ios / android应用程序。 It's an angular 1 based app and I'm using ionic to build the ios and android versions. 这是一个基于angular 1的应用程序,我正在使用ionic来构建ios和android版本。 I've got the app working in regular browsers. 我已经在常规浏览器中运行了该应用程序。 I've built the IOS version and tested it, and it works. 我已经构建了IOS版本并对其进行了测试,并且它可以工作。 Once I build the android version and test in various virtual or a real device, all that shows is a bit of code. 一旦我构建了android版本并在各种虚拟或真实设备中进行测试,所有显示的内容就是一些代码。 Here's the debug log: 这是调试日志:

 03-03 07:16:53.908 2764-2775/com.example.myuser.myapplication E/art: Failed sending reply to debugger: Broken pipe
 03-03 07:16:54.845 2764-2847/com.example.myuser.myapplication E/EGL_emulation: tid 2847: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)

ionic serve --lab works fine and shows ios and android (image attached) 离子服务--lab可以正常工作,并显示ios和android(图像已附加)

In the 2nd image (the android virtual device) you can see a few pieces of angular code. 在第二张图片(Android虚拟设备)中,您可以看到一些角度代码。

android模拟器 离子实验室

I've solved this issue and hope this helps anyone else who has the same problem. 我已经解决了这个问题,希望对其他有同样问题的人有所帮助。 After checking the chrome dev tools on the emulator or the actual android device I found 404 errors for all http/https requests. 在模拟器或实际的android设备上检查了chrome dev工具后,我发现所有http / https请求的404错误。 I had to add the cordova whitelist plugin. 我必须添加cordova白名单插件。 I added that in my ionic folder: 我在离子文件夹中添加了它:

 cordova plugin add cordova-plugin-whitelist

Others who have had this issue said they had to put some code in their index.html head section, but I did not do that. 其他遇到此问题的人说,他们必须在index.html头部分中放入一些代码,但是我没有这样做。

So the plugin apparently made the device/emulator allow http requests and all the javascript libraries and css files that were 404's were found and the app worked! 因此,该插件显然使设备/仿真器允许http请求,并且找到了所有404的javascript库和CSS文件,并且该应用正常运行!

A discussion for another question now becomes apparent, regarding external js libraries in an app. 关于应用程序中的外部js库的另一个问题的讨论现在变得显而易见。 I'm thinking I should concat them all and include that instead of using http requests. 我想我应该把它们全部合并在一起,而不要使用http请求。

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

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