(1)搭建 sencha touch 2.4 + Cordova 的环境 参考文章 https://gist.github.com/jhcarr/c0276b2978b8603c74e3
apt-get update
apt-get install build-essential
dpkg --add-architecture i386
apt-get update
apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 libz1:i386 libgcc1:i386 gcc-4.6-base:i386 libgl1-mesa-dev
apt-get install openjdk-7-jdk
apt-get install ant
apt-get install ruby1.9.3
apt-get install curl
apt-get install git
add-apt-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs
npm install -g cordova
下载 (1)Sencha Touch (2) Sencha Cmd (3)Android SDK 解压到目录下
执行命令,设置路径,权限, 我的是
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64;chmod -R 777 /usr/bin/android/sdk;export ANROID_HOME=/usr/bin/android/sdk;export ANDROID_SDK_HOME=/tmp/android/AVD;export PATH=$PATH:/usr/bin/Sencha/Cmd/5.0.2.270:/usr/bin/android/sdk/tools:/usr/bin/android/sdk/platform-tools;
(2)安装eclipse,在eclipse里安装speket,adt插件,下载tomcat,使eclipse支持j2ee,android项目
1 建立Dynamic Web Project项目,项目名称为DeviceJs,这里的路径是 /tmp/workspace/DeviceJs
2 在行命令下建立sencha touch 项目
sencha -sdk /tmp/touch-2.4.0 generate app Device /tmp/workspace/DeviceJs/WebContent
3 进入/tmp/workspace/DeviceJs/WebContent 目录执行
sencha cordova init com.myapp.device Device
4 修改app.json 里的 // Uncomment the line below and add the platforms you wish to build for 下面一行,去掉注释改为 如下
// Uncomment the line below and add the platforms you wish to build for
"platforms": "android",
5 执行命令
sencha app build native
最简单的Native程序就完成了,编译的文件是 /tmp/workspace/DeviceJs/WebContent/cordova/platforms/android/ant-build/Device-debug.apk
apt-get update
apt-get install build-essential
dpkg --add-architecture i386
apt-get update
apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 libz1:i386 libgcc1:i386 gcc-4.6-base:i386 libgl1-mesa-dev
apt-get install openjdk-7-jdk
apt-get install ant
apt-get install ruby1.9.3
apt-get install curl
apt-get install git
add-apt-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs
npm install -g cordova
下载 (1)Sencha Touch (2) Sencha Cmd (3)Android SDK 解压到目录下
执行命令,设置路径,权限, 我的是
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64;chmod -R 777 /usr/bin/android/sdk;export ANROID_HOME=/usr/bin/android/sdk;export ANDROID_SDK_HOME=/tmp/android/AVD;export PATH=$PATH:/usr/bin/Sencha/Cmd/5.0.2.270:/usr/bin/android/sdk/tools:/usr/bin/android/sdk/platform-tools;
(2)安装eclipse,在eclipse里安装speket,adt插件,下载tomcat,使eclipse支持j2ee,android项目
1 建立Dynamic Web Project项目,项目名称为DeviceJs,这里的路径是 /tmp/workspace/DeviceJs
2 在行命令下建立sencha touch 项目
sencha -sdk /tmp/touch-2.4.0 generate app Device /tmp/workspace/DeviceJs/WebContent
3 进入/tmp/workspace/DeviceJs/WebContent 目录执行
sencha cordova init com.myapp.device Device
4 修改app.json 里的 // Uncomment the line below and add the platforms you wish to build for 下面一行,去掉注释改为 如下
// Uncomment the line below and add the platforms you wish to build for
"platforms": "android",
5 执行命令
sencha app build native
最简单的Native程序就完成了,编译的文件是 /tmp/workspace/DeviceJs/WebContent/cordova/platforms/android/ant-build/Device-debug.apk
(3)然后将生成的adroid项目导入到eclipse中如图所示