http://levi.cg.am/archives/3587(看这篇就够了)
不!
这篇写得更好:http://aguegu.net/?p=1822

Cyper实战:
将android加入环境变量
$ vi ~/.bashrc

#AndroidDev PATHexport PATH=${PATH}:~/android/android-sdk-linux/toolsexport PATH=${PATH}:~/android/android-sdk-linux/platform-tools

$ source ~/.bashrc

1. Install Apache Cordova with npm

$ sudo npm install -g cordova
...
/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova
cordova@4.0.0 /usr/local/lib/node_modules/cordova

2. Create a Cordova app and cd to the new folder
$ mkdir -p ~/cordova/projects/helloworld
$ cd~/cordova/projects/helloworld
$ cordova create hello com.example.hello "Hello World"
$ cd hello/

3. Add Android as a cordova platform
$ cordova platform add android
如果出现错误Error: Please install Android target "android-19".
则先输入android打开SDK Manager勾选Android4.4.2(API 19)下面的SDK Platform和ARM EABI v7a System Image)

Creating android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.example.hello
Name: Hello World
Android target: android-19
Copying template files...
Project successfully created.

$ sudo apt-get install ant
然后ant就装好了。which ant --> /usr/bin/ant --> /usr/share/bin/ant
(如果不安装ant执行接下来的cordova emulate或build命令会报错:
Failed to run "ant -version", make sure you have ant installed and added to your PATH.)

4. Create an Android emulator
$ android create avd -n hello -t 1
Auto-selecting single ABI armeabi-v7a
Android 4.4.2 is a basic Android platform.

(-n指定avd的名称,-t指定target level,可以通过android list targets来显示目前有哪些api level)

5. Run the cordova app on the emulator
$ cordova emulate android
半天没反应

$ emulator -avd hello或者emulator @hello
Segmentation fault (core dumped)

解决:http://blog.csdn.net/ritterliu/article/details/10949833
我是这么做的,先开个terminal执行emulator-arm @hello打开模拟器,
然后呢直接cordova run android
Build an APK package
$ cordova build
BUILD SUCCESSFUL
Total time: 28 seconds
Built the following apk(s):
/home/cyper/cordova/projects/helloworld/hello/platforms/android/ant-build/CordovaApp-debug.apk



更多相关文章

  1. [Android(安卓)学习笔记] 判断 Android(安卓)设备是否为模拟器
  2. 关于 android RIL 调试
  3. android模拟器设置代理上网
  4. Ubuntu搭建Android交叉编译环境
  5. 启动emulator出错
  6. react-native android 环境配置
  7. Android开发(一)拨打电话程序
  8. Android-中常用方法集锦
  9. 从android模拟器中提取文件系统

随机推荐

  1. Android7.0中文文档(API)-- Filter
  2. gradle DSL method not found: android()
  3. Android摄像头相关问题记录
  4. Android的内存泄漏和调试
  5. 防止EditText自动获取焦点
  6. 【Android】Android中AlertDialog对话框
  7. Android(安卓)仿IOS搜索框
  8. unity AssetBundle 加载资源 笔记
  9. 清除app数据等同于设置中的清除数据
  10. Android(安卓)休眠与唤醒