Setting up PhoneGap on Ubuntu for Android app development
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Setting up PhoneGap on Ubuntu for Android app development,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2939字,纯文字阅读大概需要5分钟。
内容图文
![Setting up PhoneGap on Ubuntu for Android app development](/upload/InfoBanner/zyjiaocheng/1156/1b45d96f58a8409dbdf33d56c0cce152.jpg)
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/
原文:http://www.cnblogs.com/garygou/p/3554334.html
内容总结
以上是互联网集市为您收集整理的Setting up PhoneGap on Ubuntu for Android app development全部内容,希望文章能够帮你解决Setting up PhoneGap on Ubuntu for Android app development所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。