zoukankan      html  css  js  c++  java
  • (OK) using-VScode_cordova_ionic_taco-cli_Genymotion


    refer to http://taco.tools/articles/leap-day.html

    [root@localhost vscode]# pwd
    /opt/vscode
    [root@localhost vscode]# ls
    vscode-x86_64.rpm
    [root@localhost vscode]#
    rpm -ivh vscode-x86_64.rpm
    rpm -qlp vscode-x86_64.rpm

    [root@localhost vscode]# code
    It is recommended to start vscode as a normal user. To run as root, you must specify an alternate user data directory with the --user-data-dir argument.
    [root@localhost vscode]# mkdir vscode-user-data
    [root@localhost vscode]# code --user-data-dir=vscode-user-data
    -----------------
    [root@localhost vscode]# gedit /usr/share/applications/code.desktop
    -----------------
    [root@localhost vscode]# ls vscode-user-data/
    GPUCache  Local Storage  storage.json  User
    [root@localhost vscode]#

    // dnf install nodejs npm
    dnf install npm


    npm cache clean -f
    npm install -g n
    n stable
    ln -sf /usr/local/n/versions/node/6.2.0/bin/node /usr/bin/node

    npm install -g cordova ionic taco-cli
    npm WARN engine http-signature@1.1.1: wanted: {"node":">=0.8","npm":">=1.3.7"} (current: {"node":"v6.2.0","npm":"1.3.6"})

    [root@localhost ~]# npm install -g npm
    [root@localhost ~]# npm -v
    3.9.2
    [root@localhost ~]# npm install -g cordova ionic taco-cli
    [root@localhost ~]# tree /usr/local/lib/node_modules/ -L 1
    /usr/local/lib/node_modules/
    ├── cordova
    ├── ionic
    ├── n
    ├── npm
    └── taco-cli

    /usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova

    // npm install xmlbuilder


    [root@localhost test1]# pwd
    /opt/vscode/project/test1

    [root@localhost test1]# ionic start myLeapDay

     ✗ (node:10582) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
    Creating Ionic app in folder /opt/vscode/project/test1/myLeapDay based on tabs project
    Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
    [=============================]  100%  0.0s
    Downloading: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip
    [=============================]  100%  0.0s


    Create an ionic.io account to send Push Notifications and use the Ionic View app?
    (Y/n): y
    +---------------------------------------------------------+
    + New Ionic Updates for May 2016
    +
    + The View App just landed. Preview your apps on any device
    + http://view.ionic.io
    +
    + Invite anyone to preview and test your app
    + ionic share EMAIL
    +
    + Generate splash screens and icons with ionic resource
    + http://ionicframework.com/blog/automating-icons-and-splash-screens/
    +
    +---------------------------------------------------------+
    [root@localhost test1]#

    ******* problem
     ✗ (node:10582) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
    *******
    after update to node6 have the same issue. working workaround downgrade, e.g. nvm use v5.11.0
    *******

    [root@localhost test1]# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.1/install.sh | bash

    => Close and reopen your terminal to start using nvm

    [root@localhost test1]# nvm install v5.11.0
    [root@localhost test1]# nvm use v5.11.0

    [root@localhost test1]# nvm uninstall v5.11.0

    [root@localhost test1]# nvm install v6.2.0
    [root@localhost test1]# nvm use v6.2.0


    [root@localhost test1]# ionic start myLeapDay
    [root@localhost test1]# cd myLeapDay

    [root@localhost myLeapDay]# ls
    bower.json  config.xml  gulpfile.js  hooks  ionic.project  package.json  plugins  scss  www
    [root@localhost myLeapDay]#

    [root@localhost myLeapDay]# taco platform add android
    [root@localhost myLeapDay]# ls
    bower.json  config.xml  gulpfile.js  hooks  ionic.project  package.json  platforms  plugins  scss  www
    [root@localhost myLeapDay]# ls platforms/
    android  platforms.json
    [root@localhost myLeapDay]# ionic serve

    [root@localhost myLeapDay]# code --user-data-dir=vscode-user-data

    [root@localhost test1]# ls
    myLeapDay  node_modules
    [root@localhost test1]# wget http://taco.tools/assets/images/blogs/leap-day/leapday.zip

    [root@localhost test1]# unzip leapday.zip -d leapday
    [root@localhost test1]# ls
    leapday  leapday.zip  myLeapDay  node_modules
    [root@localhost test1]#

    [root@localhost test1]# cp leapday/1* leapday/golfballs* myLeapDay/www/img/
    [root@localhost test1]# cp leapday/tab-dash.html myLeapDay/www/templates/tab-dash.html
    cp:是否覆盖"myLeapDay/www/templates/tab-dash.html"? y
    [root@localhost test1]# cd myLeapDay/
    [root@localhost myLeapDay]# ionic serve
    [root@localhost myLeapDay]# cd -
    /opt/vscode/project/test1
    [root@localhost test1]# cp leapday/services.js myLeapDay/www/js/services.js
    cp:是否覆盖"myLeapDay/www/js/services.js"? y
    [root@localhost test1]# cd myLeapDay/
    [root@localhost myLeapDay]# ionic serve

    [root@localhost myLeapDay]# cd -
    /opt/vscode/project/test1
    [root@localhost test1]# cp leapday/chat-detail.html myLeapDay/www/templates/chat-detail.html
    cp:是否覆盖"myLeapDay/www/templates/chat-detail.html"? y
    [root@localhost test1]# cd -
    /opt/vscode/project/test1/myLeapDay
    [root@localhost myLeapDay]# ionic serve

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    [root@localhost myLeapDay]# ionic run android

    Running command: /opt/vscode/project/test1/myLeapDay/hooks/after_prepare/010_add_platform_class.js /opt/vscode/project/test1/myLeapDay
    add to body class: platform-android
    Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
    Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
    [root@localhost myLeapDay]#

    ----------------------------------
    gedit /root/.bashrc
    source /root/.bashrc
    ----------------------------------
    export ANDROID_HOME="/opt/android-on-linux/android-sdk-linux/"

    [root@localhost myLeapDay]# export ANDROID_HOME="/opt/android-on-linux/android-sdk-linux/"
    [root@localhost myLeapDay]# ionic run android
    ----------------------------------
    Running command: /opt/vscode/project/test1/myLeapDay/hooks/after_prepare/010_add_platform_class.js /opt/vscode/project/test1/myLeapDay
    add to body class: platform-android
    Error: Please install Android target: "android-23".

    Hint: Open the SDK manager by running: /opt/android-on-linux/android-sdk-linux/tools/android
    You will require:
    1. "SDK Platform" for android-23
    2. "Android SDK Platform-tools (latest)
    3. "Android SDK Build-tools" (latest)
    [root@localhost myLeapDay]#

    [root@localhost myLeapDay]# /opt/android-on-linux/android-sdk-linux/tools/android

    [root@localhost myLeapDay]# ionic run android
    Running command: /opt/vscode/project/test1/myLeapDay/hooks/after_prepare/010_add_platform_class.js /opt/vscode/project/test1/myLeapDay
    add to body class: platform-android
    ANDROID_HOME=/opt/android-on-linux/android-sdk-linux/
    JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-2.b14.fc23.x86_64
    No target specified, deploying to emulator
    Error: No emulator images (avds) found.
    1. Download desired System Image by running: /opt/android-on-linux/android-sdk-linux/tools/android sdk
    2. Create an AVD by running: /opt/android-on-linux/android-sdk-linux/tools/android avd
    HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver

    [root@localhost myLeapDay]# /opt/android-on-linux/android-sdk-linux/tools/android sdk

    [root@localhost myLeapDay]# /opt/android-on-linux/android-sdk-linux/tools/android avd

    [root@localhost myLeapDay]# taco emulate android
    Running command: /opt/vscode/project/test1/myLeapDay/hooks/after_prepare/010_add_platform_class.js /opt/vscode/project/test1/myLeapDay
    add to body class: platform-android
    ANDROID_HOME=/opt/android-on-linux/android-sdk-linux/
    JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-2.b14.fc23.x86_64
    No emulator specified, defaulting to myLeapDevice
    Waiting for emulator...
    emulator: WARNING: VM heap size set below hardware specified minimum of 384MB
    emulator: WARNING: Setting VM heap size to 768MB
    ioctl(KVM_CREATE_VM) failed: 16 设备或资源忙
    failed to initialize KVM: 设备或资源忙
    ^C
    [root@localhost myLeapDay]#
    --------------------------------------
    This is mostly because you have either VirtualBox or VMware running on the same machine. The reason (at least that’s what I think) is that the kernel module of VirtualBox or VMware and KVM can’t take Advantage of Intel VT-x or AMD-V at the same time.

    关闭virtualbox等其他虚拟机就好
    --------------------------------------

    --------------------------------------
    using "ionic emulate android" —— (/opt/android-on-linux/android-sdk-linux/tools/android)
    --------------------------------------

    [root@localhost myLeapDay]# taco emulate android        // Install the app onto your phone

    Your emulator is out of date, please update by launching Android Studio:
     - Start Android Studio
     - Select menu "Tools > Android > SDK Manager"
     - Click "SDK Tools" tab
     - Check "Android SDK Tools" checkbox
     - Click "OK"

    --------------------------------------
    using "ionic run android" —— (Genymotion & virtualbox)
    --------------------------------------
    If that doesn't work, Genymotion is a great replacement. It uses a virtual machine to emulate android devices and does it nearly perfectly. One thing to remember, if you want to deploy to a genymotion device, your computer will treat it as an actual connect machine. So instead of running

    [root@localhost genymotion]# pwd
    /opt/genymobile/genymotion
    [root@localhost genymotion]# ./genymotion

    [root@localhost myLeapDay]# pwd
    /opt/vscode/project/test1/myLeapDay
    [root@localhost myLeapDay]# ionic run android        // Install the app onto your phone

    ----------------------------------------------------------------------------
    "ionic emulate android" is faster than "ionic run android"(Genymotion & virtualbox)
    ----------------------------------------------------------------------------

      slower   "ionic app" genymotion

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


    ----------------------------------------------------------------------------
    http://stackoverflow.com/questions/18045712/gradle-build-android-project-could-not-resolve-all-dependencies-error-but-i-t

    //You will get a list of all available SDK packages. Look up the numerical values of the components from the first command above ("Google Repository" and others you might be missing).

    [root@localhost myLeapDay]#

    /opt/android-on-linux/android-sdk-linux/tools/android list sdk --all

    /opt/android-on-linux/android-sdk-linux/tools/android update sdk --no-ui --filter platform-tools,extra-android-support,extra-android-m2repository,extra-google-m2repository
    -------------------------------
    License id: android-sdk-license-c81a61d9
    Used by:
     - Android Support Repository, revision 31
      - Google Repository, revision 26
    -------------------------------

    ----------------------------------------------------------------------------
    http://stackoverflow.com/questions/32130738/emulating-ionic-really-slow-even-on-genymotion-just-using-the-tabs-example



    i'm trying to test my ionic app on genymotion but it's very slow (animations take up to 2 seconds to play, transitions are laggy)

    I could not find a solution so i tried creating a test project from scratch to see if it worked smoothly on genymotion. I tried just running these commands on the command line to build a new example project.

    ----------------------
    ionic start myApp tabs
    ionic platform android

    [root@localhost myApp]# pwd
    /opt/vscode/project/test1/myApp
    [root@localhost myApp]#

    [root@localhost myApp]# ionic run android
    Error: No platforms added to this project. Please use `cordova platform add <platform>`.
    [root@localhost myApp]# cordova platform add android
    Adding android project...
    Creating Cordova project for the Android platform:
        Path: platforms/android
        Package: com.ionicframework.starter
        Name: HelloCordova
        Activity: MainActivity
        Android target: android-23
    Android project created with cordova-android@5.1.1
    Running command: /opt/vscode/project/test1/myApp/hooks/after_prepare/010_add_platform_class.js /opt/vscode/project/test1/myApp
    add to body class: platform-android

    [root@localhost myApp]# ionic run android

    ----------------------

    after that the example app gets started on genymotion, but it's still very slow. is this normal?
    ----------------------------------------------------------------------------

    New Project


    npm install ionic -g
    ionic start my_app
    cd my_app
    // ionic browser add crosswalk
    ionic run android

    ----------------------

    Previous Ionic Project


    npm install ionic -g
    cd existing_app
    // ionic browser add crosswalk
    ionic run android

    ----------------------

    Specifying a version of Crosswalk

    ionic browser list #Find the version of Crosswalk you want.
    ionic browser add crosswalk@10.39.235.15 #Install stable version 10.39.235.15.

    ----------------------

    Building for separate architectures

    ionic build android
    ionic run android

    ionic info

    //ionic browser add crosswalk
    ionic platform add android

    -------
    在低于 Android 4.4 版本的手机中,混合 APP 默认使用的是一个比较慢的浏览器内核(4.4及以上才使用了基于 Chrome 的高速内核),因此我们可以考虑为应用添加 crosswalk 这个内核来提高 APP 的运行速度。

    ionic browser add crosswalk
    ionic browser remove crosswalk        //wish to stop using the Crosswalk plugin
    -------

    ionic plugin ls


    ----------------------

    adb --help
    adb devices
    adb -s 192.168.56.103:5555 shell

    ----------------------

    cd myApp
    adb devices
    ionic emulate android --target=192.168.56.101:5555

    ----------------------

    [root@localhost test1]# nvm install v5.11.0
    [root@localhost test1]# nvm use v5.11.0

    ----------------------
    npm uninstall -g grunt
    npm install -g grunt-cli
    grunt
    ----------------------

    ionic emulate android

    ----------------------
    ----------------------------------------------------------------------------
    Genymotion -->
    Google Nexus 7 - 4.4.4 - API 19 - 800x1280 (this vm is fast)
    Google Nexus 10 - 4.3 - API 18 - 2560x1600 (this vm is more faster)

    Note that all androids will be slow if winxp is started within virtualbox.

    ----------------------------------------------------------------------------
    ionic start myApp
    cd myApp
    ionic platform add android
    ionic build android

    ionic run android
    cordova run android

    adb devices
    ionic emulate android --target=192.168.56.104:5555
    ionic emulate android --target=192.168.56.105:5555

    ----------------------------------------------------------------------------
    ionic2
    ----------------------------------------------------------------------------
    npm install -g ionic@beta
    ionic start cutePuppyPics --v2
    cd cutePuppyPics
    // ionic serve
    ionic platform add android
    ionic run android
    ----------------------------------------------------------------------------
    // This tells Ionic to initialize your application using the tutorial template. If you don’t specify a template by running ionic start MyIonic2Project --v2, the tabs template will be used.

    ionic start MyIonic2Project tutorial --v2
    ionic start MyIonic2Project --v2
    cd MyIonic2Project
    ionic serve
    ----------------------------------------------------------------------------

    [root@localhost vscode]# pwd
    /opt/vscode
    [root@localhost vscode]#
    code --user-data-dir=vscode-user-data
    ----------------------------------------------------------------------------







  • 相关阅读:
    ET之快递测试法学习感悟20140922
    C#单元测试Nunit小结(20141018)
    oracle数据库导入导出09192255
    Mybatis-Configuration-详解
    Mybatis快速入门
    Ajax的学习笔记(一)
    php curl使用总结(一)
    ETL工具--DataX3.0实战
    SqlServer触发器的理解
    2017年的个人计划
  • 原文地址:https://www.cnblogs.com/ztguang/p/12646546.html
Copyright © 2011-2022 走看看