- 1. Installing Nodejs
- 2. Install Cordova:
- NPM install-g Cordova
- 3. Create a project:
- Cordova Create MyApp com.example.MyApp MyApp
- Where: The first MyApp is the name of a folder;
- COM.EXAMPLE.MYAPP is the app ID
- The second MyApp is the name of the project and the name of the application
- 4. Go to the folder
- CD MYAPP
- 5. Create an Android app
- Cordova Platform Add Android
- 6. Create a new Android project with Eclipse (import the MyApp catalog file just now) and you can develop it under eclipse.
- Attention:
- 1.eclipse to install the ADT plug-in first.
- 2. To download the Android SDK first, and add its path (for example: C:\Development\adt-bundle\sdk\tools) to the environment variable path.
- Otherwise , step 5 will error: [Error:an error occurred while listing Android targets]
- =============================================================
- At this point, the construction of PhoneGap is completed. So, how to combine with Sencha touch?
- 1. Install the Sencha Touch command line. (Shang Guan net download exe file: http://cdn.sencha.com/cmd/4.0. 1.45/senchacmd-4.0. 1.45-windows.exe.zip)
- 2. Unzip the Sencha touch compressed package, and store the directory for example:
- e:/webroot/touch-n.n/
- Command line, enter the directory, and execute the following command to create a Sencha touch project:
- $ Sencha Generate app MyApp: /myapp
- Or:
- SENCHA-SDK/PATH/TO/SENCHA-TOUCH-SDK Generate App Myapp/path/to/www/myapp
- 3. Go to the folder
- CD MYAPP
- 4. Add Android App support:
- Sencha Cordova Init com.example.MyApp MyApp
- Note: Keep the app ID and project name here consistent with the PHONEGAP project we created earlier.
- 5. Open the MyApp root directory, modify the Cordova.local.properties file, set the operating environment for Android:
- Cordova.platforms=android
- 6. Execute the command, package the file to the project directory.
- Sencha App Build Package
- Note: The default Sencha touch is packaged into the build folder in the MyApp directory, and I do not find the configuration to modify the path, so I need to first modify the build.xml below the MyApp to add a task:
- <target name="-after-build" >
- <copy todir="E:\phonegap-project\MyApp\platforms\android\assets\www" >
- <fileset dir="Build/package/myapp"/>
- </copy>
- </target>
- This will allow you to copy the files to the PhoneGap project directory.
- Finish it now!
- Sencha Touch a project +phonegap a project. The former outputs js+html to the latter, which is then packaged as an APK file.
- Other:
- 1. Originally Sencha built-in direct package as apk file, but my machine does not run correctly.
- BUG:
- Http://www.sencha.com/forum/showthread.php? 276203-possible-bugs-in-sencha-cmd-4.0. 1.45
- 2. The current in JS write Chinese, Sencha Touch packaging will be garbled. (Environment: Win7 + senchacmd-4.0 + SDK 2.3. 1)
- Solution: To JS inside the first line to add://@charset utf-8 can be.
Cordova3+sencha touch2.x Environment Setup