Setting up PhoneGap on Ubuntu for Android app development
This is just some notes I made, mostly taken from http://docs.phonegap.com/en/3.0.0/guide_overview_index.md.html.
I was installing PhoneGap 3.0.0 on Ubuntu 12.04.
I use Sublime Text 3 for development, so didn’t want any of the Eclipse-based tools.
Environment
First, upgrade npm, and get the latest nodejs (by installing ‘n’ and running that):
npm update npm -g
sudo npm install n -g
sudo n stable
Now install phonegap itself
sudo npm install -g phonegap
Download the Android sdk from http://developer.android.com/sdk/index.html, put it somewhere sensible and unpack it:
sudo mv ~/Downloads/adt-bundle-linux-x86-20130917.zip /opt/
cd /opt
sudo unzip adt-bundle-linux-x86-20130917.zip
sudo chmod -R 777 /opt/adt-bundle-linux-x86-20130917
Update PATH in ~/.bashrc to include the phonegap tools:
# Add android sdk
PATH=$PATH:/opt/adt-bundle-linux-x86-20130917/sdk/platform-tools:/opt/adt-bundle-linux-x86-20130917/sdk/tools
and then ‘source ~/.bashrc’ to make sure you’ve got the new path setup.
Create an app
Create a phonegap app:
phonegap create my-app
cd my-app
Run the app
Run the app:
phonegap local run android
When I did this the first time, I got an error message:
[phonegap] adding the Android platform...
[error] Please install Android target 17 (the Android 4.2 SDK). Make sure you have the latest Android tools installed as well.
So, run ‘android’, select a target (e.g. “Android 4.2.2 (API 17)”), and click the “Install 8 packages..” button
May have to repeat the “Install..” stage – different licences to be accepted on each pass for system images etc?
The run again
phonegap local run android
Nope, still didn’t work – needed an emulator to be set up.
In the ‘android’ util, go to Tools -> Manage AVDs, use the “New” button to create a new AVD, then “Start..” the AVD.
First time, it failed with messages about not finding libGL.so. Second time, it started up the emulator..
Kill that one, run it again from the command line
phonegap local build android
phonegap install android
Fires up the emulator, installs the app (you have to find it on the Home screen, probably called “Hello World”..
Deploy to the phone
The emulator seems to run very slowly, and not give much sense of what the app will actually be like on the phone.
So, deploy the app – plug in Android phone via USB, select “USB debugging” in the Developer section of the settings on the phone, and the app will be installed on the phone when you next do “phonegap install…”
Add some plugins to the project
Once you get going, add some plugins to the project:
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git
参考文章:http://julianhigman.com/blog/2013/10/17/notes-on-setting-up-phonegap-on-ubuntu-for-android-app-development/
Setting up PhoneGap on Ubuntu for Android app development的更多相关文章
- Top 6 Programming Languages for Mobile App Development
Mobile application development industry in the last five years have multiplied in leaps and bounds, ...
- 使用PhoneGap搭建一个山寨京东APP
为什么要写一个App 首先解释下写出来的这个App,其实无任何功能,只是用HTML和CSS模仿JD移动端界面写的一个适配移动端的Web界面.本篇主要内容是介绍如何使用PhoneGap把开发出来的mob ...
- phoneGap开发环境搭建(android)
1. 首先安装nodejs (http://nodejs.org/) 2. 然后在命令行输入 npm 回车 假设出现下图: 则表示成功安装 3. 安装 npm install -g cordov ...
- 【Android 应用开发】Ubuntu 下 Android Studio 开发工具使用详解 (旧版本 | 仅作参考)
. 基本上可以导入项目开始使用了 ... . 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/21035637 ...
- 【Android 应用开发】 Ubuntu 安装 Android Studio (旧版本|仅作参考)
. 果断换Ubuntu了, Ubuntu的截图效果不好, 不能设置阴影 ... 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article ...
- 使用PhoneGap搭建一个山寨京东APP(转)
为什么要写一个App 首先解释下写出来的这个App,其实无任何功能,只是用HTML和CSS模仿JD移动端界面写的一个适配移动端的Web界面.本篇主要内容是介绍如何使用PhoneGap把开发出来的m ...
- android app性能优化大汇总
这里根据网络上各位大神已经总结的知识内容做一个大汇总,作为记录,方便后续“温故知新”. 性能指标: (1)使用流畅度: 图片处理器每秒刷新的帧数(FPS),可用来指示页面是否平滑的渲染.高的帧率可以 ...
- 【Android 应用开发】Ubuntu 下 Android Studio 开发工具使用详解
. 基本上可以导入项目开始使用了 ... . 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/21035637 ...
- Ubuntu 配置 Android 开发 环境
. 果断换Ubuntu了, Ubuntu的截图效果不好, 不能设置阴影 ... 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article ...
随机推荐
- newWindow 弹出的新窗口居中显示
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- js中keydown和keypress的区别
keydown和keypress这些事件是当一个对象具有焦点时进行按下或松开一个键时发生的. keydown在按下的时候返回键盘上的代码值,然后由TranslateMessage函数翻译成字符,并且由 ...
- HTML5使用canvas画图时,图片被自动放大模糊的问题
最近在研究canvas技术,发现一个问题,就是所画图像会随着画布大小自动变换大小.原因如下 <canvas id="cxt" style="width: 500px ...
- python-创建一个本地txt文本
def text_create(name, msg): desktop_path = '/Users/Hou/Desktop/' full_path = desktop_path + name + ' ...
- 5V转3.3v电路
方案一: MIC5205-3.3 输出电流150ma 输出电压3.3V 其中:CT24为钽电容: 方案二: AMS1117-3.3 输出电流800ma 输出电压:3.3V 输入电压:4.75~12v
- Lintcode---线段树修改
对于一棵 最大线段树, 每个节点包含一个额外的 max 属性,用于存储该节点所代表区间的最大值. 设计一个 modify 的方法,接受三个参数 root. index 和 value.该方法将 roo ...
- 什么是SQL注入式攻击?
什么是SQL注入式攻击? 所谓SQL注入式攻击,就是攻击者把SQL命令插入到Web表单的输入域或页面请求的查询字符串,欺骗服务器执行恶意的SQL命令.在某些表单中,用户输入的内容直接用来构造(或者影响 ...
- C#面试题汇总2
http://www.cnblogs.com/wangjisi/archive/2010/06/14/1758347.html 用.net做B/S结构的系统,您是用几层结构来开发,每一层之间的关系以及 ...
- unity, List namespace
如果要使用List,需要using System.Collections.Generic;
- 3.2 Zend_Db_Select
10.4. Zend_Db_Select 你能够使用该对象和它的对应方法构建一个select查询语句,然后生成 字符串符用来传送给zend_db_adapter进行查询或者读取结果. 你也能够在你的查 ...