PhoneGap requires you have the following software installed:
1. Eclipse Integrated Design Environment (IDE), a program to write code and manage software development
2. Java Development Kit (JDK), the Java compiler and support tools
3. The Android Software Development Kit (SDK), base code and emulators for developing Android apps
4. Android Development Toolkit (ADT), a plug-in for Eclipse that makes Android development seamless
5. Apache Ant, a program that automates software build processes (similar to 'make')
6. Ruby, a programming language
7. Git Bash, an alternative command program for Windows environments (Windows only)
If you've previously done any development in the Android environment,
you probably have 1-4 already installed. If you have not, it is
strongly recommended you visit http://developer.android.com/index.html to
better understand Android development and create your own, "Hello,
World" example prior to jumping into PhoneGap. A great resource exists
at: http://developer.android.com/sdk/installing.html for new developers.
Step 1: Installing the Prerequisite Software
1A. Eclipse
Install the Eclipse IDE for Java Developers from http://www.eclipse.org/downloads/. This a ZIP archive file, extract the folder “eclipse”. Most other flavors of Eclipse (like Aptana or platform specific builds) will also work, provided that you install all the necessary Eclipse plug-ins.
Extract the downloaded archive and place it somewhere you'll remember
and add the tools sub directory your PATH. Additional information and
instructions for adding the Android SDK to your PATH can be found at: http://developer.android.com/sdk/installing.html
Be sure to do the following (Windows):
If you install into a folder containing a space (c:\Program Files),
you must refer to it by its truncated name in the command program. In
this case "c:\progra~1". The truncated name will be the first six
characters + ~ + a sequential number starting with 1 for each instance
of the same six characters.
Add android SDK to your Path
Add android sdk tools (\android-sdk-windows\tools) to your path.
This is necessary for ruby to find the command "android create project"
later on.
1D. ADT Plug-in for Eclipse
Install the ADT Plug-in for Eclipse as described here:
To verify your installation of Eclipse, Android SDK, ADT, and Java,
you can build a sample “Hello World” application using the instructions
located here:
If
you install into a folder containing a space (c:\Program Files), you
must refer to it by its truncated name in the command program. In this
case "c:\progra~1". The truncated name will be the first six characters
+ ~ + a sequential number starting with 1 for each instance of the same
six characters.
Download and unzip binaries
add the unzipped folder path to your PATH
OS X - it comes with XCode otherwise "sudo port install apache-ant".
Note: During installation, you may select the "Use Git Bash only" option
Step 2: Confirm Environment Variables
Environment variables are data stored by your system; in this case we
are interested in the file locations of the various developer tools.
You should have these environment variables:
ANDROID_HOME, location of the Android SDK (for example: D:/android-sdk-windows)
ANT_HOME, location of Android Ant (for example: D:\apache-ant-1.8.1)
JAVA_HOME, location of the JDK (for example: C:\Program Files\Java\jdk1.6.0_20)
Path, folders where the operating system always looks when given a command (includes these, for example: C:\Ruby191\bin; D:\apache-ant-1.8.1\bin; C:\Program Files\Java\jdk1.6.0_20\bin; D:\android-sdk-windows\tools)
You can confirm the environment variables the following way:
2C. "Edit..." the Path to include the needed folders. Use a semicolon (;) to separate folders.
Hint: You can copy the path from the address bar in Windows Explorer.
If everything looks good in the environment variables, try opening a
command prompt (Start > Run > cmd) and typing in "ant", "ruby",
"java", or "android". If you get the error message "x was not
recognized as an internal or external command" you need to check your
PATH value. If the program continues to execute you can use ctrl-c to
terminate it.
Step 3. Download the PhoneGap Source Code
First you will need to download the latest PhoneGap code. It is
hosted on github.com. The easier way to get the code is to download it
directly from the github website.
Alternatively, you may use a dedicated 'git' client to download the
code or you may use Eclipse. This guide will not cover either of those
methods.
3B. Unzip the files into a folder.
Step 4. Build the Example PhoneGap App
Now we will use Ruby and a script called 'droidgap' that is provided
with PhoneGap to package up our example app. This will create two
outputs; a file called 'PhoneGap.jar' and an Android Eclipse project,
which we will then import into Eclipse.
4A. Open a command window and change directory ('cd') to the
'phonegap-android' folder. In Windows, use git bash as the command
window. In Mac OS, use Terminal.
4B. Run the following command. This will create a PhoneGap.jar file
and create a basic Android Eclipse project in the output path that can
then be opened in Eclipse.
NOTE: The droidgap script has been updated and now there are two
methods to create the necessary files. The new script is significantly
simpler to use than the old method. For those who prefer the old method,
it is still available.
NEW METHOD:
4C. From the 'phonegap-android' folder, run 'ruby bin/droidgap create
[path_of_application]'. For the example app, the command would be 'ruby
bin/droidgap create example'. If the example folder does not exist
inside 'phonegap-android', run 'ruby bin/droidgap gen' first.
The new create command in the droidgap script will generate the
Eclipse project, ready to be imported. The results of the script can be
found at '[path_of_application]_android'. Example:
If [path_of_application] = '~/my_app', then droidgap create will place
results at '~/my_app_android'. The for the example app, the results will
be placed at '../phonegap-android/example_android'
Skip ahead to Step 5 for Eclipse import instructions.
Run 'droidgap help' to see other new commands including run, log, test and ship.
OLD METHOD:
Previous users of the droidgap script please note that droidgap must
now be invoked with the 'classic' command to use this method.
android_sdk_path ... The path to your Android SDK install. (Must use forward slashes (/) in path)
name ...................... The name of your application.
package_name ....... The name of your package (For example:
com.nitobi.demo). Can not be just the app name, must contain at least
one "." (i.e. "com.example").
www ...................... The path to your www folder. (Where your HTML, CSS and JavaScript code is located)
path ...................... The path to generate the application. (CANNOT be inside ANY Eclipse workspace) (Must use forward slashes (/) in path)
You should get a message in your terminal saying completed!
Then run `ruby ./droidgap classic
/Users/danmayer/projects/android/android-sdk-mac_86 test_app
com.mayerdan.testapp example/ ~/projects/test_droid_phonegap` again.
Some notes:
Your output path should not be inside your Eclipse workspace. *See note in Step 5
Make sure the path you set to generate the application doesn't exist
For the www folder, phonegap-android comes with a folder called example that includes some sample html, css and js.
I found I was getting errors for not having set android or ant in my path. Make sure you followed the earlier steps.
When pointing to a directory, you need to have quotes around the path "C:/mobile/......"
While in the command prompt, you should manually change all the
backslashes ( \ ) to forward slashes ( / ). This helps the droidgap
script with its syntax. E.g. The android_sdk_path argument must use forward slashes (/).
If you install into a folder containing a space (c:\Program Files),
you must refer to it by its truncated name in the command program. In
this case "c:\progra~1". Otherwise, the script will look for
"c:\Program" and fail.
Note: The truncated name will be the first six characters + '~' + a
sequential number starting with 1 for each instance of the same six
characters. For instance if you have two folders c:\PhoneGapA and
c:\PhoneGapB, the former's truncated name will become, "c:\phoneg~1" and
the latter's will become, "c:\phoneg~2".
For Windows users: The droidgap script is written to expect
UNIX-style syntax, which is why you need to use 'git bash' to execute
these commands. 'Bash' is a shell language and the 'git bash'
application can handle the expected syntax. Alternatively you may use
another bash-style command application, such as 'cygwin', but if you
know what that is, you know how to install and use it.
Do not have "tools" as a folder in your path to the android sdk folder; C:\Users\Daniel\Dev\tools\android-sdk won't work.
If at any point you need to check your PATH variables in git bash you can use the command "echo $PATH"
Step 5. Importing Your Example App into Eclipse
Now time to create your project. In Eclipse, go to File > New project > Android > Android Project
Now select create project from existing source and navigate to the
new folder that was generated in the last step. Select a build target
and press finish.
*NOTE: The folder you specified in the
Ruby script will actually be the folder that your Eclipse will save to,
and compile from and NOT your current Eclipse Workspace. Saving your
folder to a location inside of a Workspace will not allow you to create
the project because the .metadata folder. If you have pointed your
folder to one of your Eclipse Workspaces, simply cut and paste the
folder to a location that is outside of any Workspace.
Now, in Eclipse you should see your project
Rightclick phonegap.jar under the libs folder and go to Buildpath -> Add to build path.
Note: Now the folder structure should look like the one shown below.
Click on the project folder again and then the Run button in Eclipse,
it is the button that looks like "Play". When you run this project, you
should the dialog box to Run As.., choose Android Application. You
may get the unable to launch dialog, this can happen if you have the
Android 1.5 or some other file highlighted when you try to run the
project. Just select the project folder and click run.
If you have done everything correctly, there should be an Application
that loads. It should be noted that testing with an actual device is
preferable to the Emulator for many reasons, namely the fact that it's
easier to test the Accelerometer, Geolocation, Beep and Vibrate
Functionality. However, for testing on the actual browser browser
events, and various issues with Webkit on Android the Emulator does just
as well.
Notes
Perhaps JAVA_HOME does not point to the JDK. Or maybe JAVA_HOME
doesn't exist. To fix this you must right click on my computer, go to
advanced system settings, click the advanced tab, press the environment
variables button, Under system variables click new and add JAVA_HOME if
it doesn't exist and make the path to the JDK that was installed
earlier.
ERROR:
droidgap:48:in ``': No such file or directory
android create project -t 7 -k be.progone.test -a PG1 -n PG1 -p
E:/baud/work/Mobile/Pr_Eclipse/PG1/build (Errno::ENOENT) from droidgap:48:in `create_android'
SOLUTION:
Add the Android SDK tools path to the system. Follow steps above to get to system environment variables.
Eg: C:\Program Files\Android SDK\tools
ERROR: "BUILD FAILED C:\phonegap-android\framework\build.xml:49: taskdef class com.android.ant.SetupTask cannot be found"
SOLUTION: Try
going to the "framework" folder and check the path in
the local.properties file. See if its correct and pointing to your
android sdk directory.
You MUST use a forward slash in the directory (Windows users) otherwise the paths will not match up.
Eg: C:/Program Files (x86)/Android SDK
ERROR:
"Click
on various buttons on the example app, doesn't do anything" or some
things are working but I can't tell what is going on, or I want more
information how do I view the Android logs?
SOLUTION: To get
more information about what is going one while phonegap is running, run
the Android log viewer. `adb logcat` if adb isn't found you just need to
do the full path to it something like
`~/projects/andriod/android-sdk-mac_86/tools/adb logcat`. If you have
both a device and a Android emulator running use -d and -e like so `adb
-e logcat`. This should give you more info about what is going on. Here
is a small example clipping form the android logs.
D/PhoneGapLog( 291): file:///android_asset/www/phonegap.js: Line 216
: TypeError: Result of expression 'accel' [undefined] is not an object.
E/Web Console( 291): TypeError: Result of expression 'accel'
[undefined] is not an object. at
file:///android_asset/www/phonegap.js:216
D/PhoneGap( 291): The provider network is disabled
D/SntpClient( 61): request time failed: java.net.SocketException: Address family not supported by protocol
From this we can see that the accel is not working. And some
information about the location of the Error. This helps debug problems
and also helps you to give more information when asking the PhoneGap
community for help.
군자가 백성을 대할 때는 마땅히 먼저 나의 성품에 편벽된 곳을 찾아 바로잡아야 한다. 유약함은 강하게 고치고, 게으름은부지런하도록 고치고, 굳센 데 치우친 것은 관대하도록 고치고, 완만한 데 치우친 것은 위엄있고 용맹하도록 고쳐야 한다. -치현결(治縣訣)
수신제가치국평천하(修身齊家 治國平天下)! 리더가 되려거든 먼저 나를 살펴보아야 합니다. 남을 대하기는 봄 바람처럼, 자신에게는 가을 서리처럼 (대인춘풍 지기추상: 待人春風 持己秋霜) 대할 각오가 되어있지 않다면 리더의 자리를 맡을 기회가 주어진다 하더라도 적극 사양할 줄 아는 멋진 리더들이 많아지길 기대해봅니다.
늪이
없는 연꽃은
존재할 수 없습니다.
연꽃 없는 늪은 죽은 늪입니다.
늪과 연꽃은 서로가 서로에게 의지처요
모체입니다. 어느 하나는 버리고,
어느 하나를 천하게 여길 수가
없습니다.
- 도법의《그물코 인생 그물코 사랑》중에서 -
* 옹달샘 못에도 연을 심었습니다.
그냥 '못'이었다가 진짜 '연못'이 된 셈이지요.
못이 있어 연을 심고, 연이 있어 못도 살아납니다.
당신과 나, 둘이 하나가 된 우리는 연못과 같습니다.
당신이 있어 내가 살고, 내가 있어 당신이 삽니다.
둘이 따로 떨어져 존재할 수 없는,
우리는 연못입니다.
오늘의 맑은 이 아침. 이 순간에 그대의 행동을 다스리라. 순간의 일이 그대의 먼 장래를 결정한다. 오늘 즉시 한 가지 행동을 결정하라. 나쁜 습관을 버리고 좋은 습관을 가져야 한다. 오늘 그릇된 한 가지 습관을 고치는 것은 새롭고 강한 성격으로 출발한다는 것을 의미한다. 새로운 습관은 새로운 운명을 열어줄 것이다. -라이너 마리아 릴케
성공하는 사람들은 하루를 인생의 최대 승부처로 삼았습니다. 인생은 ‘하루들의 집합’이기 때문입니다. 이 하루를 결정하는 것이 바로 습관입니다. 존 맥스웰은 “일상을 바꾸기 전에는 삶을 변화시킬 수 없다. 성공의 비밀은 자기 일상에 있다”고 말했습니다. 우 리가 생각하고 느끼고, 행동하고 성취하는 모든 것들의 95%가 습관의 결과라는 연구 결과도 있습니다.
여자들의
폐경에 대해서는
많은 사람들이 잘 알고 있으나
남자들의 '폐경'은 일반적으로 인식된 현상이 아니다.
하지만 남자들의 폐경도 여자들의 폐경 못지않게
우리가 관심을 가져야 할 문제이다. 왜냐하면
여자들의 폐경이 여자들의 삶에 큰 영향을
끼치듯 남자들의 폐경도 남자들의 삶에
큰 영향을 끼치기 때문이다.
- 게일 쉬히의《남자의 인생 지도》중에서 -
* 인생의 황혼기에 들면
남자든 여자든 별 차이가 없습니다.
육체의 기력은 줄고 피의 순환도 끊기거나 막힙니다.
이때야말로 정신의 기력을 높여야 할 때입니다.
사랑과 지혜와 이타심으로 높여진 정신의 힘!
그 정신의 힘이 다른 사람에게 힘이 될 때
남자, 또는 여자들의 폐경은 오히려
큰 축복이 됩니다.
Axure
RP gives you the wireframing, prototyping and specification tools
needed to make informed design choices, persuade any skeptics, get your
design built to spec... and maybe win a few fans along the way.
중요한 일을 미루는 것은 불행한 사람들의 공통점이다. 그들은 지금은 때가 아니라고 실천을 미룬다. 그러면서 새해가 되면, 생일날부터, 결혼기념일부터 시작하겠다고 다짐한다. 새로운 시작을 위한 완벽한 타이밍은 없다. 금연을 하기에 가장 좋은 날은 없다. 공부를 시작하기에 가장 좋은 시간도 없다. 실천하기 가장 좋은 날은 ‘오늘’이고 실행하기 가장 좋은 시간은 ‘지금’이다. -이민규, ‘실행이 답이다.’에서
변화의 가장 큰 걸림돌은 ‘나중에, 다른 데서’ 이며, 성공의 가장 확실한 디딤돌은 ‘지금 여기서 Now & here'입니다. 후회는 아무리 빨라도 늦고, 시작은 아무리 늦어도 빠른 것입니다. 미국 루스벨트 대통령은 “지금 있는 자리에서, 가지고 있는 것으로, 할 수 있는 것을 하라!”라고 웅변합니다.
세상이
아름답게 보이기 시작한 건
세상을 아름답게 볼 줄 아는 눈을 갖게 되면서부터다.
그전까지 나는 나 혼자 살아가기에도 바쁘고 벅차서
내가 보지 않는 곳에서 벌어지는 일들에 대해
무관심했다. 뒤늦게나마 그런 곳으로
눈을 돌리니 세상 모든 일이
다 달라 보였다.
- 이동혁의《아침수목원》중에서 -
* 어느 순간
깨달음을 얻을 때가 있습니다.
아주 사소한 것에서 비롯된 깨달음인데,
삶의 대전환이 이루어지는 순간이기도 합니다.
방금 만난 풀 한 포기, 나무 한 그루가 너무 아름답고
이 시간 마음에 그리는 사람 하나가 그렇게
소중하고 아름다울 수가 없습니다.
세상의 모든 것이 감사하고
아름답게만 보입니다.
꽃과
잡초는
구분되는 것이 아니다.
잡초란 인간이 붙인 지극히
이기적인 이름일 뿐이다.
인간의 잣대로 해충과 익충을
구분하는 것처럼.
그러나 인간이 뭐라고 하던
제비꽃은 장미꽃을 부러워하지 않는다.
이 세상에 예쁘지 않은 꽃은 없다.
- 정호승의《이 시를 가슴에 품는다》중에서 -
* 가끔 다른 사람과 나를 비교하다 보니
자주 내가 아름답다는 사실을 잊고 삽니다.
그렇습니다. 이 세상에 예쁘지 않은 꽃은 없습니다.
예쁘지 않은 사람도 없습니다. 사람마다 예쁜 구석 하나쯤은
반드시 가지고 있습니다. 남이 가진 아름다움을 탐내지
말고, 내가 가진 아름다움을 빛내는
사람이 되어야 겠습니다.