• ionic app调试问题


    以下是一些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:Workspacegitbookexplorerplatformsandroidgitbookexplorer.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
    "platformsandroidgitbookexplorer.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"
    }
    }

  • 相关阅读:
    http://www.cnblogs.com/CBDoctor/p/4459750.html
    java枚举使用详解
    在Spring3中使用注解(@Scheduled)创建计划任务
    数据库建模软件ERStudio-表关系建模详解
    使用ERStudio创建数据表与ER图
    Eclipse plugin插件开发 NoClassDefFoundError
    window.open被IE拦截的解决办法
    【技术贴】解决Eclipse中SVN图标不显示
    电脑问题交流QQ群
    Maven开源中国镜像
  • 原文地址:https://www.cnblogs.com/adoontheway/p/7065921.html
Copyright © 2020-2023  润新知