Android Development Learning--ionic+cordova Environment Building

Source: Internet
Author: User

What do we see Ionic can offer us? A style library that you can use to decorate your HTML Web page, which looks like you want to move the program's interface, what header, content, footer, grid, list. This seems to be nothing substantial, Sencha touch, JQ can provide. A Library of tools written in AngularJS, let's call it a component library. Ionic's grid design is more reasonable and more powerful than bootstrap. Of course it also contains angular-animate, Angular-resource, Angular-sanitize, Angular-ui-router, adapted to the Mobile Platform Module Library. Apache Cordova provides APIs to access the mobile platform using JavaScript. The inside is the Web view component under each platform, run the program, and then implement a set of cordovalib for you to write in each platform, then you can call the camera, disk and other APIs.  1. Install node Environment NODEJS Environment installation is very simple, to the official website to download the latest version of the Nodejs directly installed. Node Official website: https://nodejs.org/Configuring environment variables after installation is complete, user variables, environment variables, properties--- Add the node path after the value of the variable, with other variable values; After the configuration is complete, enter npm-v carriage return in CMD. If the version number appears, the installation succeeds. (did not successfully configure the node environment Baidu)  2. Install the JDK and configure the environment variable jdk:http://www.oracle.com/technetwork/java/javase/downloads/ Jdk8-downloads-2133151.html Configure environment variables after installation is complete: java_home (the installation path has spaces will not be valid) (System variables): JDK installation path, the environment variable itself does not exist, need to create, The value is: The JDK's installation path on your computer. Path (System variable): The Path property already exists and can be edited directly. The function is used to configure the path, simplifying the input of the command with a value of:%java_home%\bin. CLASSPATH (System variable): used to compile the path of the Java class, note that this is set to two values, (.;) Indicates that the JVM searches the current directory first. The value is:.; %java_home%\lib\tools.jar. After the configuration is complete, run the following command through CMD: java-version, if the return message appears, the setting succeeds.  3. Install Android sdk.1:http://developer.android.com/sdk/index.html This address has been wall. Need to use FQ. 2:http://www.android-studio.org/This is the Android studio Chinese community address here you can only download Android SDK without having to download Android studio. Download complete and install and then add two values to the user variable path. is the path to the tools directory in the Android SDK and the path to the Platform-tools, respectively. For example: C:\Program Files (x86) \android\android-sdk\tools; C:\Program Files (x86) \android\android-sdk\platform-tools; If you find that the Android SDK installation directory does not have the "Platform-tools" folder, you should run the Android.bat file in the Tools directory, then the following screen appears, tick the Android SDK Platform-tools and then install. After the environment variable configuration is complete, enter Android in CMD and return. If the Android SDK Manager appears, the installation is successful.  4. Install the Apache ant.ant:http://ant.apache.org/bindownload.cgi environment variable: There are 2 main environment variables used by Windows ant: Ant_home and PATH. Eg:1. Set Ant_home to the installation directory (system variable) for Ant. Setup method: Ant_home = d:\dev\apache-ant-1.9.6-bin\apache-ant-1.9.62. Set the bin and Lib directories into the path variable (user variable). Will%ant_home%\bin; The%ant_home%\lib is added to the path of the x variable. Setup method: PATH =%ant_home%\bin; %ant_home%\lib installation If not successful, you can change the%ant_home% to a real path. such as:     d:\dev\apache-ant-1.9.6-bin\apache-ant-1.9.6\bin;d:\dev\apache-ant-1.9.6-bin\apache-ant-1.9.6\ After the Lib installation is complete, enter ant-version in CMD to verify that the installation was successful.  5. Using NPM to download ionicc:\users\lemon>npm install-g IonicC:\Users\lemon\AppData\Roaming\npm\ionic-C:\Users\lemon\AppData\Roaming\npm\node_modules\ionic\bin\ionicC : \USERS\LEMON\APPDATA\ROAMING\NPM '--[email protected] 6.install Cordova with npm commandC:\users\lemon>NPM install-g CordovaNPM WARN deprecated [email protected]: Use UUID module Insteadc:\users\lemon\appdata\roaming\npm\cordova-C:\Users\ LEMON\APPDATA\ROAMING\NPM\NODE_MODULES\CORDOVA\BIN\CORDOVAC:\USERS\LEMON\APPDATA\ROAMING\NPM '--[email protected ] 7.Create a projectC:\users\lemon>ionic start todo blank [WARN] Git CLI not found on your PATH. wish to the install it to version control your app. See Installation docs for Git:https://git-scm.com/book/en/v2/getting-started-installing-gituse--no-git to disable This warning.√creating directory. \todo-done! [INFO] Fetching app Base (https://github.com/ionic-team/ionic2-app-base/archive/master.tar.gz) √downloading-done! [INFO] Fetching starter Template Blank (https://github.com/ionic-team/ionic2-starter-blank/archive/master.tar.gz) √ Downloading-done!√updating Package.json with App details-done!√creating configuration file ionic.config.json-done! [INFO] Installing dependencies may take several minutes!> npm install√running command-done!> npm Install--save-dev--sa Ve-exact @ionic/[email protected]√running command-done!? ? ? ? Your Ionic app is ready to go!???? Run your app in the browser (great for initial development):Ionic serveRun on a device or simulator:Ionic Cordova Run iOSTest and share your app on a device with the Ionic View App:http://view.ionic.io 8.Configure the PlatformC:\users\lemon\todo>Ionic Cordova Platform Add Android? The plugin @ionic/cli-plugin-cordova are not installed. Would to install it and continue? yes> npm Install--save-dev--save-exact @ionic/[email protected]√running command-done!> Cordova Platform AD D Android--save√running command-done! Using Cordova-fetch for [email protected]~6.2.2adding Android project ... Creating Cordova Project for the Android platform:path:platforms\androidpackage:io.ionic.startername:myappactivity: Mainactivityandroid Target:android-25subproject Path:cordovalibandroid Project created with [email protected] Discovered plugin "cordova-plugin-console" in config. Adding it to the projectinstalling "Cordova-plugin-console" for androidadding Cordova-plugin-console to Package.jsonsaved plugin info for ' cordova-plugin-console ' to config.xmldiscovered plugin ' Cordova-plugin-device ' in Config. Adding it to the projectinstalling ' Cordova-plugin-device ' for androidadding Cordova-plugin-device to package . jsonsaved Plugin Info foR "Cordova-plugin-device" to config.xmldiscovered plugin "cordova-plugin-splashscreen" in config. Adding it to the projectinstalling "Cordova-plugin-splashscreen" for androidadding Cordova-plugin-splashscreen to Package.jsonsaved Plugin info for "Cordova-plugin-splashscreen" to config.xmldiscovered plugin " Cordova-plugin-statusbar "in config. Adding it to the projectinstalling "Cordova-plugin-statusbar" for androidadding Cordova-plugin-statusbar to Package.jsonsaved Plugin info for "Cordova-plugin-statusbar" to config.xmldiscovered plugin "Cordova-plugin-whitelist" in CONFIG. Adding it to the projectinstalling "cordova-plugin-whitelist" for Androidthis plugin are only applicable for versions of CO Rdova-android greater than 4.0. If you had a previous platform version, you did *not* need this plugin since the whitelist would be built in. Adding cordova-plugin-whitelist to package.jsonsaved plugin info for "cordova-plugin-whitelist" to config.xmldiscovered Plugin "Ionic-plugin-keYboard "in config. Adding it to the projectinstalling "Ionic-plugin-keyboard" for androidadding Ionic-plugin-keyboard to package.jsonsaved p Lugin info for "Ionic-plugin-keyboard" to Config.xml--save flag or AutoSave detectedsaving [email protected]~6.2.3 I nto config file ... √copying default image resources into ./resources/android-done! 

Open with the IDE as follows:

Then let's run it.

In the Android environment:

Ionic platform Add Android//join to wirelessly

Ionic build Android//pack

Ionic run Android//real Machine

Ionic emulate Android//virtual machine

iOS as well, change Android to iOS

Other than that

Ionic serve//run on browser, automatically opens browser

Temporarily summarize this piece

Android Development Learning--ionic+cordova Environment Building

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.