以下是一些ionic app在模拟器中的调试问题:

1. CORS问题

官方原文以及解释:Handling CORS issues in Ionic

国内翻译:彻底解决Ionic项目中的跨域问题

2. SplashScreen之后显示问题

如图,默认的侧边滚动条也在,页首位置也在,布局都在,就是内容显示异常,只显示黑块和白块。

这个是在添加crosswalk之后出现的,crosswalk支持的android api是16以上;

我使用的是genymotion,运行:ionic cordova run android,在Chrome中console没有报错;

运行ionic cordova run android -l -c 就会出现CORS问题,原理见1;

运行ionic cordova run android --device --prod,出现提示:

[WARN] Error occurred during command execution from a CLI plugin
(@ionic/cli-plugin-cordova). Your plugins may be out of date.
Error: Type AboutPage in /src/pages/about/about.ts is part of the declarations of 2 modules: AppModule in /src/app/app.module.ts and AboutPageModule in /src/pages/about/about.module.ts! 
Please consider moving AboutPage in /src/pages/about/about.ts to a higher module that imports AppModule in /src/app/app.module.ts and AboutPageModule in/src/pages/about/about.module.ts. 
You can also create a new NgModule that exports and includes AboutPage in /src/pages/about/about.ts then import that NgModule in AppModule in /src/app/app.module.ts and AboutPageModule in /src/pages/about/about.module.ts.

这个报错好解决,在app.module.ts中

import { AboutPageModule } from '../pages/about/about.module';

然后imports中加入 AboutPageModule。

但是运行命令的话还是黑白块。

打包Genymotion emulator的log观察发现报错了,基本上是emulator启动过程中就报错了,报错的关键部分:

06-22 04:14:44.461 I/AudioFlinger( 240): Using default 3000 mSec as standby time.
06-22 04:14:44.462 E/ ( 240): batterystats service unavailable!

06-22 04:14:44.462 E/ ( 240): batterystats service unavailable!

06-22 04:14:44.465 I/CameraService( 240): CameraService started (pid=240)

06-22 04:14:44.465 I/CameraService( 240): CameraService process starting

06-22 04:14:44.465 E/ ( 240): batterystats service unavailable!

06-22 04:14:44.465 E/ ( 240): batterystats service unavailable!

06-22 04:14:44.513 W/gatekeeperd( 133): falling back to software GateKeeper

06-22 04:14:44.744 I/SurfaceFlinger( 229): SurfaceFlinger is starting

06-22 04:14:44.744 I/SurfaceFlinger( 229): SurfaceFlinger's main thread ready to run. Initializing graphics H/W...

06-22 04:14:44.868 I/Genymotion( 225): overriding Battery service paths with fake ones

06-22 04:14:44.925 D/libEGL ( 229): loaded /system/lib/egl/libEGL_emulation.so

06-22 04:14:44.926 D/libEGL ( 229): loaded /system/lib/egl/libGLESv1_CM_emulation.so

06-22 04:14:44.930 D/libEGL ( 229): loaded /system/lib/egl/libGLESv2_emulation.so

06-22 04:14:44.933 E/ ( 229): Failed to connect to host (UnixStream)!!!

06-22 04:14:44.933 E/EGL_emulation( 229): Failed to establish connection with the host

06-22 04:14:44.933 W/libEGL ( 229): eglInitialize(0xf6bbf080) failed (EGL_SUCCESS)

06-22 04:14:44.965 E/ ( 229): Failed to connect to host (UnixStream)!!!

06-22 04:14:44.965 E/gralloc_vbox86( 229): gralloc: Failed to get host connection

06-22 04:14:44.965 E/SurfaceFlinger( 229): hwcomposer module not found

06-22 04:14:44.965 E/SurfaceFlinger( 229): ERROR: failed to open framebuffer (I/O error), aborting

--------- beginning of crash

06-22 04:14:44.965 F/libc ( 229): Fatal signal 6 (SIGABRT), code -6 in tid 229 (surfaceflinger)

06-22 04:14:45.004 I/iptables( 236): iptables v1.4.20: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)

06-22 04:14:45.004 I/iptables( 236): Perhaps iptables or your kernel needs to be upgraded.

06-22 04:14:45.004 I/iptables( 236): iptables terminated by exit(3)

06-22 04:14:45.004 E/Netd ( 236): exec() res=0, status=768 for /system/bin/iptables -w -t nat -N oem_nat_pre

06-22 04:14:45.007 I/iptables( 236): iptables v1.4.20: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)

06-22 04:14:45.007 I/iptables( 236): Perhaps iptables or your kernel needs to be upgraded.

06-22 04:14:45.007 I/iptables( 236): iptables terminated by exit(3)

06-22 04:14:45.007 E/Netd ( 236): exec() res=0, status=768 for /system/bin/iptables -w -t nat -A PREROUTING -j oem_nat_pre

06-22 04:14:45.019 I/iptables( 236): iptables v1.4.20: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)

06-22 04:14:45.019 I/iptables( 236): Perhaps iptables or your kernel needs to be upgraded.

06-22 04:14:45.020 I/iptables( 236): iptables terminated by exit(3)

06-22 04:14:45.020 E/Netd ( 236): exec() res=0, status=768 for /system/bin/iptables -w -t nat -N natctrl_nat_POSTROUTING

06-22 04:14:45.024 I/iptables( 236): iptables v1.4.20: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)

06-22 04:14:45.024 I/iptables( 236): Perhaps iptables or your kernel needs to be upgraded.

06-22 04:14:45.024 I/iptables( 236): iptables terminated by exit(3)

06-22 04:14:45.024 E/Netd ( 236): exec() res=0, status=768 for /system/bin/iptables -w -t nat -A POSTROUTING -j natctrl_nat_POSTROUTING

06-22 04:14:45.072 F/DEBUG ( 237): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

06-22 04:14:45.072 F/DEBUG ( 237): Build fingerprint: 'Android/vbox86p/vbox86p:6.0/MRA58K/genymotion03201937:userdebug/test-keys'

也就是emulator本身已经崩溃了,
网上搜索这个错误的时候,
有人说是在创建emulator的时候选择use host gpu,
但是genymotion没地方选,最起码我用的个人版是没有的,
于是打开AVD,
查看emulator,
检查他有没有选择use host gpu,
没有的话就选上,
然后启动这个emulator,
然后运行ionic cordova run android。
bingo,正常运行。
 
3.Keystore was tampered with, or password was incorrect

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':packageArmv7Release'.
> com.android.ide.common.signing.KeytoolException: Failed to read key
gitbookexplorer from store
"D:\Workspace\gitbookexplorer\platforms\android\gitbookexplorer.keystore
":
Keystore was tampered with, or password was incorrect

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output.
BUILD FAILED

Total time: 2.429 secs
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':packageArmv7Release'.
> com.android.ide.common.signing.KeytoolException: Failed to read key
from store
"\platforms\android\gitbookexplorer.keystore
":
Keystore was tampered with, or password was incorrect

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output.

没有提示输入密码,搜索错误:

or reference, I needed to update the release-signing.properties to:
storeFile=../../key.keystore
keyAlias=mykey
keyPassword=password
storePassword=password

These override the setting in build.gradle:
signingConfigs {
release {
// These must be set or Gradle will complain (even if they are overridden).
keyAlias = ""
keyPassword = "__unset" // And these must be set to non-empty in order to have the signing step added to the task graph.
storeFile = null
storePassword = "__unset"
}
}

ionic app调试问题的更多相关文章

  1. 方法:怎么用ionic命令行调试你的ionic app

    官网上有很详细的解说  http://blog.ionic.io/live-reload-all-things-ionic-cli/ 下面说说我自己的调试过程(android版): 首先用命令行进入你 ...

  2. Android学习系列(37)--App调试内存泄露之Context篇(下)

    接着<Android学习系列(36)--App调试内存泄露之Context篇(上)>继续分析. 5. AsyncTask对象 我N年前去盛大面过一次试,当时面试官极力推荐我使用AsyncT ...

  3. ionic app打包和签名

    ionic app打包和签名 1.首先在项目根目录执行  ionic platform add android  生成Android平台. 2.配置应用签名:在根目录下执行以下命令 keytool - ...

  4. Ionic App之国际化(3) json数组的处理

    接上一篇Ionic App之国际化(2) json数组的处理 之后,如何处理json数据长度的问题,目前的一个折中方法是翻译长度字段. 多语言文件内容: "MyLa": { &qu ...

  5. Ionic App之国际化(2) json数组的处理

    在Ionic App值国际化(1)中我们实现了对单个参数的多语言处理,下面开始如何进行数组的处理. 1.在我们的多语言文件中设置要访问的json数组,en.json和zh.json,此处就以en.js ...

  6. Ionic app 上传图片之webApi接口

    App上传图片对应的webApi服务端是怎么处理的呢? using System; using System.Collections.Generic; using System.Diagnostics ...

  7. Ionic app升级插件开发

    终于走到了写插件的这个地方了,插件的过程: 1.安装plugman插件,管理我们的程序 npm install -g plugman 2.创建插件项目appUpgrade,cd 到你的目标目录下,执行 ...

  8. 【ionic App问题总结系列】ionic 如何更新app版本

    ionic 如何进行自动更新 ionic App更新有两种方式:第一种是普通的从远程下载apk,安装并覆盖旧版本.另外一种就是采用替换www文件夹的内容,实现应用内更新,而无需下载安装apk. 这篇文 ...

  9. Android APP 调试过程中遇到的问题。

    调试过过程中APP安装完启动后有的时候会异常退出,报这个错误.有的时候可以直接启动.查找不到原因.网上说把commit方法替换成commitAllowingStateLoss() 也无效. Andro ...

  10. [Ionic2] Device Interaction in an Ionic App with Cordova Plugins

    In this lesson, we are going to learn how to interact with native components through Cordova plugins ...

随机推荐

  1. 癌症中克隆种群结构统计推断分析软件PyClone安装小记

    由于微信不允许外部链接,你需要点击文章尾部左下角的 "阅读原文",才能访问文中链接. PyClone 是一种用于推断癌症中克隆种群结构的统计模型. 它是一种贝叶斯聚类方法,用于将深 ...

  2. 【PAT】 1002 写出这个数 Rust Solution

    读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字. 输入格式: 每个测试输入包含 1 个测试用例,即给出自然数 n 的值.这里保证 n 小于 10​100​​. 输出格式: 在一行 ...

  3. JUC同步锁原理源码解析二--ReentrantReadWriteLock

    JUC同步锁原理源码解析二----ReentrantReadWriteLock 1.读写锁的来源 ​ 在开发场景下,对于写操作我们为了保证原子性所以需要上锁,但是对于读操作,由于其不改变数据,只是单纯 ...

  4. 设计 C++ 接口文件的小技巧之 PIMPL

    设计 C++ 接口文件的小技巧之 PIMPL C++ 里面有一些惯用法(idioms),如 RAII,PIMPL,copy-swap.CRTP.SFINAE 等.今天要说的是 PIMPL,即 Poin ...

  5. LeetCode 周赛 350(2023/06/18)01 背包变型题

    本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 [彭旭锐] 和 [BaguTree Pro] 知识星球提问. 往期回顾:LeetCode 单周赛第 348 场 · 数位 DP ...

  6. 好用到飞起的新项目「GitHub 热点速览」

    虽然本周 GitHub 热榜都是一些熟悉的面孔,但还是有不少新开源的项目,比如受启发于 Stripe IDs 的 UUIDv7 扩展 typeid,相信有了它,数据标识问题就迎刃而解了.此外,还有刚开 ...

  7. 自研ORM 子查询&嵌套查询

    作者 Mr-zhong 代码改变世界.... 一.前言 Fast Framework 基于NET6.0 封装的轻量级 ORM 框架 支持多种数据库 SqlServer Oracle MySql Pos ...

  8. 使用LabVIEW实现 DeepLabv3+ 语义分割含源码

    前言 图像分割可以分为两类:语义分割(Semantic Segmentation)和实例分割(Instance Segmentation),前面已经给大家介绍过两者的区别,并就如何在labview上实 ...

  9. 生成CSV文件的方法*(LIST集合为数据和生成的文件名)

    /** * 生成csv文件 * @param pointsList 组织实体 * filename 生成的文件名 * list 要生成的数据 * @return */ public void Poin ...

  10. 瞬间抠图!揭秘 ZEGO 绿幕抠图算法背后的技术

    抠图是图像处理中最常见的操作之一,指的是将图像中需要的部分从画面中精确的提取出来. 抠图的主要功能是为了后期的合成做准备.在 Photoshop 中,抠图的方法有很多种,最常见的有通道抠图.蒙版抠图. ...