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. 【PHPmailer】发送邮件(以163邮箱为例)

    1.参考TP社区:http://www.thinkphp.cn/code/989.html 2.phpmailer.rar下载地址:http://www.thinkphp.cn/code/downlo ...

  2. Asp.Net MVC项目通过Git同步到新开发设备上后无法作为网站启动

    右键项目名->属性->启动项目->单启动项目,在下拉框中选择你的网站主项目就可以了.(由于用的英文版,所以翻译的内容可能略有差异)

  3. 自制MVC之工具类插件一

    1).BreakRomoteURLAttribute 提交或交互的URL数据是否来源于其它地方,站内提交,防止跨站 2). DataAttribute 取得post或get提交的数据.如果没有特殊设置 ...

  4. JS正则表达式(转载)

    在JavaScript中,RegExp对象表示正则表达式,用来对字符串进行匹配. 一.两种定义方法: 1.直接量法: /pattern/attribute 2.对象法: new RegExp(patt ...

  5. 兼容placeholder

    众所周知.IE9以下不兼容placeholder属性,因此自己定义了一个jQuery插件placeHolder.js.以下为placeHolder.js的代码: /** * 该控件兼容IE9下面,专门 ...

  6. windows和linux中换行符的转换

    数据开发平台使用上传脚本报错:保存失败,文件编码格式不正确,请修改文件换行符为Unix终束符! 修改方式:DOS系统下,使用文本编译器另存为,然后选择换行符为unix终束符. 解释: windows ...

  7. ubuntu彻底干净卸载MySQL、Apache2、Php的方法(各版本通用

    一.卸载删除 mysql   1 sudo apt-get autoremove --purge mysql-server-5.0 2 sudo apt-get remove mysql-server ...

  8. Ubuntu 启动项、菜单 改动 防止隐藏

    因为电脑有多个系统,默认的grub引引导菜单是隐藏的,须要略微改动下方可显示 不要直接改动boot/grub/grub.cfg  要直接改动/etc/default/grub,然后update-gru ...

  9. TI_DSP_corePac_带宽管理 - 1.2(仲裁寄存器)

    下图为仲裁寄存器,重要的是理解SDMAARB寄存器.在该寄存器中仅仅须要设计MAXWAIT值,PRI(优先级)设置要在外设(如FFTC,AIF2等)提供的仲裁寄存器中设置,由于是外设在訪问slave, ...

  10. scala读写文件

    def main(args: Array[String]): Unit = { //1 read for( i<- Source.fromFile("test.dat").g ...