Essential tools for sencha touch 2.3 environment setup
Sencha touch 2.3 Package
Sencha cmd 4.0 or above
Java JDK 1.7 or above (note the differences between JDK and JRE)
Ruby 1.9.3 or earlier
Android SDK
Note: Add JDK, Ruby, and sencha cmd to the environment variable path.
For example, JDK path:
Java_home variable path: C: \ Program Files (x86) \ Java \ jdk1.7.0 _ 67
JDK path is % java_home % \ bin; % java_home % \ JRE \ bin
RUBY: C: \ ruby193 \ bin
After sencha CMD is installed, it seems that a system variable will be added. No need to set
Add the tools and platform-tools folders in the android SDK folder to the environment variable path.
OK. After the environment is set up, we will use the sencha cmd command line to create a project framework.
CD touch-2.3.1
Sencha generate app MyApp ../MyApp
Test and release webapp Products
OK. No surprise. Now a complete demo application is displayed in front of you.
So far, if you don't bother with traffic and loading efficiency, you can use it directly if an application has been completed.
However, sencha provides us with a better way to publish an app. You can directly compress and package the resources required in the project to perform HTML5 offline caching, our applications can also be used offline after the first loading (except for data access)
Sencha provides four release methods.
Testing: used for testing and QA
Package: away from web server, local HTML file resource package
Production: A published webapp product.
Native: package it into Android APK or iOS app Local Installation File
We only need to execute a line of command in cmd to release our product:
# Production, testing, native, package
# Go To Your MyApp folder generated by CMD
Sencha app build production
To package Android APK or IOS, you must modify the packager. JSON file. For more information, see the official documentation.
Http://docs.sencha.com/touch/2.3.1! /GUIDE/native_packaging
You can use commands to generate an APK file.
Sencha app build native
Use Cordova or phonegap in combination
Apache Cordova and phonegap are actually the same thing. Apache Cordova is an open-source community, and phonegap is Adobe's own brand.
The relationship between the two is similar to that between centos and RedHat.
Take Cordova as an example. If you want sencha touch to use the device API provided by Cordova, first prepare the following software:
1. nodejs
2. After nodejs is installed, execute it in the command line.
NPM install-G Cordova to install CORDOVA
3. APACHE-ant
After installation, add the bin folders under the Cordova and APACHE-ant directories to the environment variable path.
Example:
Cordova: % USERPROFILE % \ appdata \ roaming \ NPM
Apache-ant: % USERPROFILE % \ bin \ apache-ant-1.9.4 \ bin
Add the tools and platform-tools folders in the android SDK folder to the environment variable path.
How to add the sencha touch project to Cordova
CMD Go To The sencha toucha project directory
Sencha Cordova init [appid]
[Appid] indicates the appid of the program, for example, Com. Elon. MyApp.
If [appid] is not specified, the default value is foo. Bar. appname.
After the command is executed, the cordova. Local. properties file and the Cordova folder are generated.
Modify the cordova. Local. properties file
Cordova. Platforms = IOS Android BlackBerry WP8
To the desired platform, such as Android
Finally generate the apk file command
Sencha app build native
Note: because the project has been supported by Cordova, The sencha app build native command will not be configured according to the packager. JSON file.
But according to the Cordova configuration file. For more information, see the official documentation.
Http://cordova.apache.org/docs/en/edge/guide_overview_index.md.html#Overview
The configuration file for Android is in/Cordova/config. xml
After the build is successful, you can find the APK file under Cordova \ platforms \ Android \ ant-build.
In fact, Cordova \ platforms \ Android \ has an android project folder, which can be opened with eclipse.exe.