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. C/C++中float和double的存储结构(转)

    在C/C++中float是32位的,double是64位的,两者在内存中的存储方式和能够表示的精度均不同,目前C/C++编译器标准都遵照IEEE制定的浮点数表示法来进行float,double运算. ...

  2. 文本域textarea

      文本域 CreateTime--2017年5月23日15:12:08Author:Marydon 二.文本域 (一)语法 <textarea></textarea> (二) ...

  3. Annotation:系统内建Annotation

    1,掌握系统内建的三个Annotation. Annotation被称为元数据特效,也被称为注释,即:使用注释方式,加入一些程序信息. Java.lang.annotation接口是所有Annotai ...

  4. 基于Netty的RPC简易实现

    代码地址如下:http://www.demodashi.com/demo/13448.html 可以给你提供思路 也可以让你学到Netty相关的知识 当然,这只是一种实现方式 需求 看下图,其实这个项 ...

  5. 【微信小程序】转载:微信小程序实战篇-下拉刷新与加载更多

    下拉刷新 实现下拉刷新目前能想到的有两种方式 1. 调用系统的API,系统有提供下拉刷新的API接口 当然,你可以直接在全局变量app.json的window里面配置上面这个属性,这样整个项目都允许下 ...

  6. Wireshark-配合tcpdump对Android(安卓)手机抓包

    环境:Windows, 安装真机(可以获取Root权限), adb, Wireshark, tcpdump 原理: 使用 tcpdump 进行抓包, 然后用 Wireshark 进行分析 1.获取手机 ...

  7. RecSys Challenge 2015

    [The Task] Given a sequence of click events performed by some user during a typical session in an e- ...

  8. AHM ---301重定向

    使用amh.conf 或重新创建一个test.conf配置文件 .保存目录 /usr/local/nginx/conf/rewrite 例如跳到 www.shuaixingkeji.com if ($ ...

  9. C#使用技巧之调用JS脚本(转)

    .创建个Winform项目. .在From1上增加一个文本框一个按钮. .在解决方案中创建一个test.js文件. test.js代码如下: function sayHello(str) { retu ...

  10. Java并发编程(六):Java里实现对象安全发布的四种方式

    接上篇,首先要了解什么是对象的发布与逸出? Java里安全发布对象的四种方法1.单例(注意懒汉和饿汉的区别)2.静态属性,注意类里的静态域和静态代码块的顺序有要求3.枚举4.final