博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Setting up PhoneGap on Ubuntu for Android app development
阅读量:5054 次
发布时间:2019-06-12

本文共 2706 字,大约阅读时间需要 9 分钟。

This is just some notes I made, mostly taken from .

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 -gsudo npm install n -gsudo 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 /optsudo 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 sdkPATH=$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-appcd 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 androidphonegap 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.gitphonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git 参考文章:

转载于:https://www.cnblogs.com/garygou/p/3554334.html

你可能感兴趣的文章
Linux内核_实验三:跟踪分析Linux内核的启动过程
查看>>
电脑是怎样识别USB3.0 U盘的
查看>>
Unity 捕获IronPython脚本错误
查看>>
word批量打印工具,c#写的
查看>>
Asp.Net MVC学习总结(一)——Asp.Net MVC简单入门
查看>>
Python学习第四篇——列表访问与判定
查看>>
JavaScript
查看>>
配置SVTI
查看>>
light oj 1138 - Trailing Zeroes (III)(阶乘末尾0)
查看>>
Windows如何自定义U盘盘符、文件夹图标、文件夹背景
查看>>
非常不错的WCF入门文章,来自Artech
查看>>
ColumnView.ShownEditor Event
查看>>
nodejs pipe实现大文件拷贝
查看>>
javascript之定义函数时 this 和prototype区别
查看>>
springboot入门_发送邮件
查看>>
关于科学选择地图投影类型的探讨
查看>>
Oracle 去重查询
查看>>
Alan Turing的纪录片观后感
查看>>
c#自定义控件中的事件处理
查看>>
hadoop1.2.1 伪分布式配置
查看>>