A tentative approach to ionic + hybrid app

Source: Internet
Author: User

Of course the first problem, the deployment environment

1. Node. JS Environment is required

2, installation Ionic

  npm install -g cordova ionic  //安装 cordova 和 ionic command-line tools

3. Construction projects

  ionic start myApp tabsCreating a MyApp project can also be blank or Sidemenu

  cd myApp

  ionic platform add android //如果是ios,则这边以及下面 substitute android with ios

  ionic build android  //这边可能会环境报错,需要  ant工具

  ionic emulate android   //这步如果有emulator用emulator,也可以直接把上一步build出来的 apk 安装到手机里 adb install ***.apk

Error handling:

  typical error 1: Android_home is notset and ' ANDROID ' command not

The typical error, workaround can:sudo vim ~/.bash_profile

    

#定义 Android-related variables
Export android_home= $ANDROID _home:/users/liangzhongyuan/bin/SDK export Android_platform_tools= $ANDROID _ platform_tools:/users/liangzhongyuan/bin/sdk/platform-toolsexport android_tools= $ANDROID _tools:/users/ liangzhongyuan/bin/sdk/Tools
#这边是我之前部署androidstudio环境时用的, it is recommended to retain export path= $PATH:/users/liangzhongyuan/bin/sdkexport Path= $PATH:/ users/liangzhongyuan/bin/sdk/platform-toolsexport PATH= $PATH:/users/liangzhongyuan/bin/sdk/tools

Finally:source ~/.bash_profile //Make environment variable take effect, remember only current or new terminal window after completion, will take effect

  

  Check:$ export    //可以看到android_home之类变量

  typical error 2:ant command not found

When a code project is large, every recompile, package, test, and so on will become very complex and repetitive, so there are make scripts in C to help with the batch completion of these tasks. The application in Java is platform-agnostic, and of course does not use platform-related make scripts to complete these batch tasks, ant itself is such a process scripting engine, for automating the calling program to complete the project compilation, packaging, testing, etc.

To compile that step, said Ant command did not find, I am still very depressed, sdk/tools/the following ant is a folder, there is no ant command, can only be installed on their own.

Installation:

1. Direct Download Path: Http://ftp.twaren.net/Unix/Web/apache//ant/binaries/apache-ant-1.9.4-bin.zip

2, after decompression, really useful only two folders, bin and lib,ant command in the bin.

3. Build an ant folder yourself, and then copy the bin and Lib in

4. Modify the environment variables to make the ant command valid. export path= $PATH:/users/user name/bin/ant/bin/

      5. Source makes it effective.

6, Ant-v View the current version, are OK. If the newspaper build.xml not found, do not worry, no matter, this will be generated when you compile the project, so continue to runionic build android 成功!

    

RELATED links:

http://ionicframework.com/getting-started///Ionic official website installation

http://ant.apache.org/bindownload.cgi//apache Ant's official website download path, the next Zip compressed package convenient

Http://mobile.51cto.com/android-265990.htm//ant principle

A tentative approach to ionic + hybrid app

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.