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的更多相关文章

  1. Top 6 Programming Languages for Mobile App Development

    Mobile application development industry in the last five years have multiplied in leaps and bounds, ...

  2. 使用PhoneGap搭建一个山寨京东APP

    为什么要写一个App 首先解释下写出来的这个App,其实无任何功能,只是用HTML和CSS模仿JD移动端界面写的一个适配移动端的Web界面.本篇主要内容是介绍如何使用PhoneGap把开发出来的mob ...

  3. phoneGap开发环境搭建(android)

    1.  首先安装nodejs  (http://nodejs.org/) 2.  然后在命令行输入 npm 回车 假设出现下图: 则表示成功安装 3. 安装 npm install -g cordov ...

  4. 【Android 应用开发】Ubuntu 下 Android Studio 开发工具使用详解 (旧版本 | 仅作参考)

    . 基本上可以导入项目开始使用了 ... . 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/21035637 ...

  5. 【Android 应用开发】 Ubuntu 安装 Android Studio (旧版本|仅作参考)

    . 果断换Ubuntu了, Ubuntu的截图效果不好, 不能设置阴影 ... 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article ...

  6. 使用PhoneGap搭建一个山寨京东APP(转)

      为什么要写一个App 首先解释下写出来的这个App,其实无任何功能,只是用HTML和CSS模仿JD移动端界面写的一个适配移动端的Web界面.本篇主要内容是介绍如何使用PhoneGap把开发出来的m ...

  7. android app性能优化大汇总

    这里根据网络上各位大神已经总结的知识内容做一个大汇总,作为记录,方便后续“温故知新”. 性能指标: (1)使用流畅度:  图片处理器每秒刷新的帧数(FPS),可用来指示页面是否平滑的渲染.高的帧率可以 ...

  8. 【Android 应用开发】Ubuntu 下 Android Studio 开发工具使用详解

    . 基本上可以导入项目开始使用了 ... . 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/21035637 ...

  9. Ubuntu 配置 Android 开发 环境

    . 果断换Ubuntu了, Ubuntu的截图效果不好, 不能设置阴影 ... 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article ...

随机推荐

  1. Android版俄罗斯方块的实现

    学习Android的基本开发也有一段时间了,可是由于没有常常使用Android渐渐的也就忘记了. Android编程学的不深,不过为了对付逆向,可是有时还是会感到力不从心的.毕竟不是一个计算机专业毕业 ...

  2. ASP.NET 之XML:要插入的节点出自不同的文档上下文

    异常详细信息:   System.ArgumentException:   要插入的节点出自不同的文档上下文. 产生状况:现在有两个xml文件,我想把这两个xml合并,在给xml节点插入一个子节点时出 ...

  3. Excel 출력

    NativeExcel 참조 사이트 http://www.nika-soft.com/dwnld.htm IWorkbook book = Factory.CreateWorkbook(); lWo ...

  4. GNU Linux高并发性能优化方案

    /*********************************************************** * Author : Samson * Date : 07/14/2015 * ...

  5. 多线程-join()方法

    在很多情况下,主进程创建并启动子线程,如果子线程中要进行大量的耗时运算,主线程往往将早于子线程结束之前结束.这时,如果主线程想等待子线程执行完成之后再结束,比如子线程处理一个数据,主线程要取得这个数据 ...

  6. SQL 数据库分页语句

    declare @pagesize integer,@cpage integer; ; ; SELECT TOP (@pagesize) * FROM (SELECT row_number() ove ...

  7. UVA Problem B: Fire!

    Problem B: Fire! Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and t ...

  8. Powershell对象选择,排序和变量存储

    PowerShell基础教程(17)——对象的选择.排序和变量存储 可以使用 Select-Object cmdlet 来创建新的.自定义的 Windows PowerShell 对象,后者包含的属性 ...

  9. NPOI 导出Excel图片 (网络)

    导出网络图片,需要将网络图片下载到本地或者内存流中,建议下载的时候使用缩略图: 高清图片效率慢: Uri uri = new Uri(imgPath); //imgPath :网络图片地址 WebRe ...

  10. 在Ubuntu中安装mongodb

    # 下载密钥文件 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 gpg: 下载密钥‘7F0CEB ...