http://www.jianshu.com/p/5df88764f024
http://www.jianshu.com/p/b9757a5bcb07
首先更新了JDK直接在原目录安装 在改一下 环境变量 即检测成功。
安装Android sdk 如图 有显示成功 有的安装底高两个版本:
安装后 配置环境变量:
我的电脑 - 右键属性 - 高级系统设置 - 环境变量
新建变量名 变量值
ANDROID_HOME D:\ionic\androidsdk(你sdk的路径)
然后在path里添加(注意前面的分号)
;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools
执行android -h看到命令即安装设置成功
2)执行androidsdk目录下的SDK Manager.exe即可打开工具包(若打不开,请用管理员权限运行!);
最后用项目测试打包 apk 出现了报错
1 For example, an unrecognized jvm option is used. 2 Please refer to the user guide chapter on the daemon at https://docs.gradle.org/ 3 2.14.1/userguide/gradle_daemon.html 4 Please read the following process output to find out more: 5 ----------------------- 6 Error occurred during initialization of VM 7 Could not reserve enough space for 2097152KB object heap 8 9 10 * Try: 11 Run with --stacktrace option to get the stack trace. Run with --info or --debug 12 option to get more log output. 13 14 Error: cmd: Command failed with exit code 1 Error output: 15 FAILURE: Build failed with an exception. 16 17 * What went wrong: 18 Unable to start the daemon process. 19 This problem might be caused by incorrect configuration of the daemon. 20 For example, an unrecognized jvm option is used. 21 Please refer to the user guide chapter on the daemon at https://docs.gradle.org/ 22 2.14.1/userguide/gradle_daemon.html 23 Please read the following process output to find out more: 24 ----------------------- 25 Error occurred during initialization of VM 26 Could not reserve enough space for 2097152KB object heap
解决办法;
最后用个心项目 后 打包 在手机上运行成功。
常用命令:
npm install -g cnpm --registry=https://registry.npm.taobao.org(npm镜像源指向淘宝)
cnpm install -g cordova ionic(安装cordova ionic)
cnpm update -g cordova ionic(更新cordova ionic)
ionic -help(查看帮助)
ionic -v(查看版本)
ionic start myApp blank(空项目)
ionic start myApp tabs(带导航条)
ionic start myApp sidemenu(带侧滑菜单)
ionic platform add android(添加android平台)
ionic platform remove android(移除android平台)
ionic build android(编译项目apk)
ionic emulate android(运行项目apk 手机连接在手机运行 模拟器连接在模拟器运行)
ionic run android(相当于build + emulate)
ionic serve(开启服务调试)