Sie sind auf Seite 1von 13

Clean Code Development - Quality Seal: How to install phoneGap for ndroid using !

in""" Page 1 of 13

Share

#ore

Next $lo-L

5reate $lo-

Si-n In

Improve your skills and share your expirience!

Email address... SUNDAY N!"E#$E% && '(&' $C!+/S 2!2UCA%I0Y

Submit

)o* to install phone+ap ,or Android usin- .indo*s and Eclipse


)i there! .hile installin- phone+ap on .indo*s usin- the ne*st Eclipse version i/ve -ot some problems. 0hat/s the reason i *rote this post. 0he 1Getting Started with Android1 -uide ,rom 2hone+ap is -ood but does not sho* all pit,alls you may encounter like i did. In this post we will learn how to: Install Apache Ant Install 3ava 3D4 Install Eclispe 5lassic Set all needed environment variables 63A"A7)!#E AN08)!#E and so on9 Install the Android AD0 2lu-in ,or Eclipse Install the Android SD4 Intall 2hone+ap Apache 5ordova '.'.( Avoid the pit,alls *hile creatin- Android 2ro:ects
!0)E% IN0E%ES0IN+ 2!S0S

G '(&& 6H9 I '(&' 6&'9 G Bebruary 6J9 G #arch 6'9 G !ctober 6=9 I November 6&9 )o* to install phone+ap ,or Android usin.indo*s ... G December 6'9 G '(&J 6&K9 G '(&= 6'9

A$!U0 #E $ASE %EEUI%E#EN0S $EB!%E S0A%0IN+

Ricardo Ferreira Application En-ineer "isionary and Ideolo-ist ,or a better .orld. "ie* my complete pro,ile

be sure you have all those tools installed be,ore -oin- ,urther6*e *ill see it step by step don/t *orry97 2it,all 52U visuali;ation Apache ant 6i used &.<.=9 3ava 3D4 6i used :dk&.>.(8(>9 Android SD4 Eclipse 5lassic 6i used version =.'.&9 All 2ath variables has been set 63A"A8)!#E AN08)!#E9

.)! A%E 3!IN+ USM

*ith +oo-le Briend 5onnect

Members (24) #ore L 2I0BACC 52U "ISUACIFA0I!N

$e,ore doin- all those steps 6like i did9 -o to the end o, this post 1Launch your project1 and check i, your 52U supports visuali;ation. I, not -o and by another 25 ,irst or up-rade your 52U i, possible! ?@9 !ther*ise at the end o, this post you *ill be disapointed. 0hat/s *hat happened to me because there *as no advise *hile installin- 2hone+ap 5ordova.
D!.NC!ADIN+ A2A5)E AN0 AND SE00IN+ 0)E AN08)!#E "A%IA$CE

-ot to Apache Ant @ $inary Distribution and do*nload the version you *ant. in my case it *as the ne*st one ant &.<.=6at the time o, this blo- *as *ritten9

Already a memberM Si-n in

0A+S O CA$ECS

android 6'(9

clean code 6&&9 ho*to 6H9 Almanac 6>9 Eclipse 6>9 3ava 6K9 app 6N9

create a ,older called ANT in the directory 1C:\Program iles\1 and un;ip the do*nloaded ,ile in it. $y me it looks like that7 C:\Program iles\ANT\apache!ant!"#$#% No* copy this path 657A2ro-ram BilesAAN0Aapache@ant@&.<.=9 and set the ANT_HOME path. to do that -o to7 Start & System Setting & System and 'aintenance & System & Ad(anced System Settings & )n(ironment (aria*le & *y System (aria*le clic+ the *utton new & and then type in7 ANT,-.') and C:\Program iles\ANT\apache!ant!"#$#% into the ,ields. A,ter that you must add this ne* variable to you 2A0). Cook ,or 2ath in the box System variable and press edit. 0hen add you ne* AN08)!#E path like this to the and o, you 2ath7 /ANT,-.')/\*in0 Don/t *orry it is easier as you think. See the screen seDuences bello*7

http:''(lean(odedevelopment-)ualityseal"*logspot"in'#%1#'11'how-to-install-phonegap-fo""" #$-%3-#%1&

Clean Code Development - Quality Seal: How to install phoneGap for ndroid using !in""" Page # of 13

http:''(lean(odedevelopment-)ualityseal"*logspot"in'#%1#'11'how-to-install-phonegap-fo""" #$-%3-#%1&

Clean Code Development - Quality Seal: How to install phoneGap for ndroid using !in""" Page 3 of 13

D!.NC!ADIN+ 3A"A 3D4 AND SE00IN+ 0)E 3A"A8)!#E "A%IA$CE

$e,ore doin- that ,ind out *hich kind o, processor your 25 supports and then take the version *ith ,its to your 25. 6J'$it or K=$it9 0o ,ind it out *hich one you have -o to Start & System Setting & System and 'aintenance & System then you *ill see the in,ormation o, your 25 like J'bit or K=bit system. see the screen seDuences bello*7

!4 no* *e *ill do the same process *ith the 3A"A 3D4 as *e did *ith AN0 in the last section. 0hat/s a -ood exercise to see i, you can do it by your sel,. +o to 3ava SE Do*nloads and do*nload the version you *ant. In my case *as :dk&.>.(8(> ath the time i *rote this post.

http:''(lean(odedevelopment-)ualityseal"*logspot"in'#%1#'11'how-to-install-phonegap-fo""" #$-%3-#%1&

Clean Code Development - Quality Seal: How to install phoneGap for ndroid using !in""" Page & of 13

+ood! No* :ust run the installer by doble clickin- it and install it in the de,ault directory it has been proposed by the *i;ard. Somethin- like this by me7 C:\Program iles\1a(a\jd+"#2#3,32 No* do the same steps as *e did by Ant and set the 1A4A,-.') variable and add it to your 2ath.
D!.NC!ADIN+ AND INS0ACCIN+ AND%!ID SD4

+o to7 Android SD4 and do*nload the installer. Double click it and install it in the proposed de,ault ,older. by me it looks like this7 C:\Program iles\Android\android!sd+. 0hat/s all *e need to kno* about it.

I'P.5TANT: No* do the same steps as *e did by Ant and set the AN65.I6,-.') variable and add it to your 2ath 78T instead o, selectin- a bin@,older you '8ST add plat,orm@tools and tools to it like that7 /AN65.I6,-.')/\plat9orm!tools0 and /AN65.I6,-.')/\tools0
D!.NC!ADIN+ E5CI2SE 5CASSI5 AND INS0ACCIN+ 0)E AND%!ID 2CU+IN

+reat! .e are ,ast there. Cet/s do*nload and install Eclipse no*. 0hat/s *ill be our development tool. +o to Eclipse Do*nloads and do*nload the classic version version you *ant. In my case *as =.'.& at the time i *rote this blo-. As you kno* no* *hich plat,orm you have 6J'bit or K=bit9 you can take the one *hich ,its to your 25. In my case it is the J'bit version.

$ecause i/m usin- Norton as a security and virus protector i descided to intall Eclipse in my user home so i do not have problems *ith admin ri-hts and so on. I recommend to do it that *ay i, you have similar settin-. $y me i looks like this7 C:\8sers\5icardo\I6)\classic In there you un;ip the do*nloaded ,ile. A,ter that you/ll have somethin- like this in it7 57AUsersA%icardoAIDEAclassicAeclipse. I also recommendo to chan-e the rename the ,older eclipse to eclipse!%#:#". 0his is use,ul i, you may install other eclipse types and versions later but it is up to you to decide *hat ,its better to you. No* let/s install the Android 2lu-in. In the directory o, your Eclipse double click eclipse#e;e to start it.

5lose the *elcome tab and then select -elp & Install new so9tware### and install the AD0 2lu-in as described bello*. See the screen seDuences bello*7 PS: A,ter installin- Android AD0 Eclipse may ask you to restart it. Say yes. At this point the Android SD4 #ana-er may start and sho*s a list ,rom uninstalled packa-es to you :ust select them all and install it. this may

http:''(lean(odedevelopment-)ualityseal"*logspot"in'#%1#'11'how-to-install-phonegap-fo""" #$-%3-#%1&

Clean Code Development - Quality Seal: How to install phoneGap for ndroid using !in""" Page + of 13

take several minutes.

Alternatively you may -o to Installin- Eclipse AD0 2lu-in and take the steps directly ,rom there.

D!.NC!AD AND INS0ACC 2)!NE+A2 A2A5)E 5!%D!"A

It is -ettin- interrestin-. Cets do*nload and install Apache 5ordova no*. +o to7 Apache 5ordova and do*nload the version you *ant. At the time o, this post it *as version '.&.(.

http:''(lean(odedevelopment-)ualityseal"*logspot"in'#%1#'11'how-to-install-phonegap-fo""" #$-%3-#%1&

Clean Code Development - Quality Seal: How to install phoneGap fo !nd oid using "in### Page 6 of 13

First pitfall: Do not unzip this file in the default folder C:\Program Files because of the spaces in it. Instead of that, create a new directory called: C:\development and unzip it in there. By me it looks like this: C:\development\cordova !.".#. $hen in this directory unzip the file incubator-cordova-android. By me it looks like this:

2I$*033( 45I3' C.'0$I67 2.89'C$(

Pitfall one: Do not create your pro%ects in the same directory as the eclipse workspace. $his will result in a failure while tryin& to open your pro%ect later with 'clipse. Pitfall two: Do not create a folder to hold your pro%ects. If you do that, that followin& (tep will fail with the statement: This project exits already in the window command prompt console. $his must be done with the create command we will see bellow. Creating Projects: $hat)s the interrestin& part. &o into unziped directory called C:\development\cordova-!"#"$\incubatorcordova-android select the bin folder, press and hold the key shift and press ri&ht mouse click. *rom conte+t menu select open command prompt from here. By me it looks like this:

$hen run the create command with your coordinates to create a new pro%ect. by me it looks like this: C:\development\cordova !.".#\incubator cordova android\bin,create C:\-sers\.icar do\ID'\classic\eclipse\android/pro%ects com.yourcompany.appname pro%ectname Pitfall: $he folder android%projects does not e+its already. It will be created with the create command above. If you create it manually before runnin& the create command, you)ll &et an error sayin&: This project already exists (o do not create it manually. 0 new pro%ect will be created. Don)t worry if you &et a 1suposed1 error here. Important is to check if the pro%ect was really created. $o be sure &o into directory C:\&sers\'icardo\()*\classic\eclipse\android%projects and if there is a somethin& like this bellow, then you are fine.

http:(()lean)odedevelopment-*ualityseal#+logspot#in($&1$(11(how-to-install-phonegap-fo### $%-&3-$&1'

Clean Code Development - Quality Seal: How to install phoneGap fo !nd oid using "in### Page , of 13

380DI67 C.'0$'D 2.89'C$ I6$8 'C3I2('

6ow we are almost done: (tart 'clipse a&ain ;if not already runnin&< and press Ctrl + , and select -ndroid Project from *xisting Code . root to your created folder android%projects . select the new created project and press finish. 6ow we are ready to start. P/: If while startin& 'clipse the 0ndroid (D= >ana&er starts and shows a list from uninstalled packa&es to you, %ust select them all and install it. this may take several minutes.

86' >8.' $5I67: @ < C.'0$I67 06 0?D ;06D.8ID ?I.$-03 D'?IC'<

$hat)s the 'mulator in which you will simulate a 2hone Device. 4e need to create one before startin& the 0pp.

30-6C5I67 A8-. 2.89'C$

If you &et an error like this bellow, then your processor may not support ?isualization. $o find out if your C2- supports visualization you may &o to Intel C2- and check it out by typin& your C2- type in the search field. In my case, my C2- does

http:(()lean)odedevelopment-*ualityseal#+logspot#in($&1$(11(how-to-install-phonegap-fo### $%-&3-$&1'

Clean Code Development - Quality Seal: How to install phoneGap fo !nd oid using "in### Page - of 13

not supports visualization @ ;

See here how to create your: *irst 0ndroid 0pp step by step

Advertising:
8ptimized bets for playin& 'uro>illion)s lottery on your >obile 2hone:

.eactions: 2osted by .icardo *erreira at B:"C 0> 3abels: android, 'clipse, howto, 9ava, phone&ap, pitfall
+2 Recommend this on Google

DE comments:
fbaheux 6ovember "!, !#"! at B:CE 0> $hanks for this &reat article, do you know if it)s possible to test the correct instal of each part ;ant, %dk and android sdk< F 4hen i try to create a new pro%ect i have this messa&e error : >issin& one of the followin&: 9D=: http:GG%ava.oracle.com 0ndroid (D=: http:GGdeveloper.android.com 0pache ant: http:GGant.apache.or& $hanks *red

http:(()lean)odedevelopment-*ualityseal#+logspot#in($&1$(11(how-to-install-phonegap-fo### $%-&3-$&1'

Clean Code Development - Quality Seal: How to install phoneGap fo !nd oid using "in### Page % of 13

.eply

fbaheux 6ovember "!, !#"! at H:"! 0> 8k i found my error, cmd prompt was open when i add the keys. (o close the cmd prompt, re open it, and do the create the pro%ect. *red .eply

Andre Dixon 6ovember "H, !#"! at I:DE 0> 7ood article. In terms of virtualization, there is the option is software virtualization which does not need a processor that is able to support a 5yper visor. ?irtualBo+ is able to do it and I have ran android 8( in it before, however, I have never attempted to connected to it via 0DB. .eply

Joshua Richards 6ovember "H, !#"! at H:DD 2> 0wesome article. 4indows is a tou&h cookie. I followed all your instructions, but when I run as on my device, I &et the followin&: "" "H !!:CI:ED.JBI: 'G4eb Console;"BI!<: -ncau&ht $ype'rror: 8b%ect Kob%ect 8b%ectL has no method )retrieve9s>essa&es) at file:GGGandroid/assetGwwwGcordova !.!.#.%s:HHB

and the test app han&s at 1Connectin& Device1 0ny thou&htsF $hank you .eply

Ricardo Ferreira

6ovember !D, !#"! at ":!J 2>

hummm i have no idea man. i suppose &oo&le haven)t any answert ri&htF i will ask my colle&ues. If i have any news i)ll post it here ok. sorry for that. I would appreciate if you post your solution here helpin& me and others in case you find a solution before i do. thanks: .eply

Luke Snowden 6ovember !I, !#"! at J:!# 0> *or anyone who can)t &et this workin&, ban&in& there heads a&ainst walls and stuff, don)t copy from the te+t on the site: M06D.8ID/58>' M\platform tools@ and M06D.8ID/58>' M\tools@ is how it copies, take out the spaces ;M06D.8ID/58>'M\platform tools@ and M06D.8ID/58>'M\tools@< re&ards .eply .eplies Ricardo Ferreira 6ovember !J, !#"! at "#:EB 0>

5i 3uke: thanks: i hi&hly appreciate your help. i have corrected this typo: sorry for that: Reply

uncle fester December ", !#"! at D:CC 2> i did everythin& here and I still &et >issin& one of the followin&: 9D=: http:GG%ava.oracle.com 0ndroid (D=: http:GGdeveloper.android.com 0pache ant: http:GGant.apache.or& I have redone all these instruction D or E times now. 5owever I have fi+ed my problem. I tested all the necessary commands %ava, %avac and ant. *irstly %avac was not bein& reco&nised. $o fi+ this I set the paths to reference the bin and libs in the %ava directory. $his fi+ed the %avac not runnin&. 6e+t create was complainin& that it could retrieve http:GGmvnrepository.comGartifactGcommons codecGcommons codecG".I. the commons codec, i found one here

http:(()lean)odedevelopment-*ualityseal#+logspot#in($&1$(11(how-to-install-phonegap-fo### $%-&3-$&1'

Clean Code Development - Quality Seal: How to install phoneGap fo !nd oid using ###

Page 1& of 13

$hen everythin& became fine a&ain : < .eply

uncle fester December ", !#"! at D:CJ 2> oh i put the commons codec in cordova\framwork\libs .eply

autsky Lo!ano "# December !, !#"! at H:"C 2> $hanks :< .eply

Ruoran Lu December !J, !#"! at !:CI 2>

.eply

Diogo Lopes December !H, !#"! at "#:EC 0> 2itfall: commons codec ".J doesn)t work now. -se ".I: http:GGmvnrepository.comGartifactGcommons codecGcommons codecG".I .eply

Diogo Lopes December !H, !#"! at "":"I 0> update: sdk E.! still don)t have Intel 0tom option. .eply

Diogo Lopes December !H, !#"! at "":C# 0> N! updates: If you &et: 15a+ not workin&...1 try install 1intel +BI emulator accelerator1. If you &et: 1*ailed to allocate memory1, allocate less memory to 0?D. C"!mb maybe works. .eply

Rugge 9anuary !H, !#"D at !:#I 0> I had the messa&e: >issin& one of the followin&: 9D=: http:GG%ava.oracle.com 0ndroid (D=: http:GGdeveloper.android.com 0pache ant: http:GGant.apache.or& 0nd I found very useful this post in &oo&le &roups:

*rom the command prompt do echo M90?0/58>'M if that variable is not set you will have to set it as well. >ake sure it &oes to the root of your 9D= install and not the bin directory of your 9D= install. 3et me know if that helps. (imon >ac Donald .eply

Anony$ous 9anuary D#, !#"D at I:"D 0> $hank you : ?ery &ood tutorial, but i &et an error messa&e in that process: 1$hen run the create command with your coordinates to create a new pro%ect. by me it looks like this: C:\development\cordova !.".#\incubator cordova android\bin,create C:\....\...\... com.yourcompany.appname pro%ektname1 0fter pressin& 'nter,$erminal prompts an C(C.I2$ 'rror :1 Der Befehl 1cscript1 ist etweder falsch &eschrieben oder konnte nicht &efunden werden1

http:(()lean)odedevelopment-*ualityseal#+logspot#in($&1$(11(how-to-install-phonegap-fo### $%-&3-$&1'

Clean Code Development - Quality Seal: How to install phoneGap for ndroid using !!!

Page 11 of 13

System 64 Bit / Win7 Whats wrong ? Reply

Anonymous February 4, 20 ! at 0"#4 $% &han' you (ery mu)h *or this use*ul tutorial+ , still get %issing one o* the *ollowing" -./" http"//0a(a+ora)le+)om 1n2roi2 S./" http"//2e(eloper+an2roi2+)om 1pa)he ant" http"//ant+apa)he+org , thin' $honegap *ol2er is not resi2ing at )orre)t lo)ation+ , 'ept it )"3.e(elopment3$honegap+ 4an you pl5 help me out to pla)e it on right pla)e+ &han' in a2(an)e+ Reply

Mickael Pillet February 6, 20 ! at !"24 1% 6ello, , ha2 the same problems with the *ollowing errors " %issing one o* the *ollowing" -./" http"//0a(a+ora)le+)om 1n2roi2 S./" http"//2e(eloper+an2roi2+)om 1pa)he ant" http"//ant+apa)he+org &he *irst thing i mo2i*ie2, it7s the System $ath 89-1:1;6<%=98 with the )urrent (alue 89-1:1;6<%=93bin8+ &hen, i trie2 to laun)h the )reate )omman2, but an error o))ure2 as an un'nown )omman2+ , laun)he2 the )omman2s as an a2ministrator an2 it wor'e2+ , hope it will be use*ul i* you ha(e the same problems+ %i)'ael+ Reply

Anonymous February 6, 20 ! at 4" > 1% thn's Ri)ar2o *or this great tuto+ you sa(e me man " ? Reply

Anonymous February 20, 20 ! at >"!7 $% ,* you are ha(ing trouble with the *ollowing error" %issing one o* the *ollowing" -./" http"//0a(a+ora)le+)om 1n2roi2 S./" http"//2e(eloper+an2roi2+)om 1pa)he ant" http"//ant+apa)he+org %a'e sure your en(ironment (ariables 1@.R<,.;6<%=, 1@&;6<%=, an2 -1:1;6<%= 2on7t )ontain the 97s, an2 that your $1&6 (ariable .<=S )ontain them+ &his was my problem+ &han' you (ery mu)h *or the tutorial Ri)ar2oA $er*e)tA Reply

Anonymous %ar)h !, 20 ! at 0" 2 $% &han' youA you sa(e2 my 2ay+ $honegap user gui2e 2oes not eBplain )learly as what you 2i2 whi)h too' me > hour to *igure out the error+ &han's again an2 'eep it up+ Reply

ilham %ar)h 22, 20 ! at "02 1% &61@/ C<D (ery mu)h A , almost 2rop my tears when , *oun2 this post+ &his post sa(e2 my time+ &han's you+ &han' you+ &han' youA Reply

Anonymous 1pril 7, 20 ! at 7" ! 1% :ery goo2 gui2e++++++ &han's helpe2 alot+++

http:&&'lean'odedevelopment-(ualityseal!)logspot!in&"$1"&11&how-to-install-phonegap-fo!!! "#-$3-"$1%

Clean Code Development - Quality Seal: How to install phoneGap for ndroid using !!!

Page 1" of 13

Reply

Shai %ay 2, 20 ! at #"#7 1% Ereat gui2e+ So annoying that it is su)h a pain to set it up on Win2ows+ Reply

Anonymous %ay !, 20 ! at >" 6 1% Simply the best gui2e on internet *or setting up phonegap on win2owsA 4heers *rom ,@.,1 Reply

Camilo Silva %ay 7, 20 ! at "47 $% &his was the B=S& tutorial+ , trie2 *or nearly 6 hours until , *oun2 this site+ , also 'ept trying Simon7s tutorial but 2i2nt Fuite wor'+ But still it might be help*ul *or others" http"//simonma)2onal2+blogspot+)a/20 2/ /gettingG)reateG)omman2GtoGwor'Gon+html &han's *or your help Ri)ar2o+ Reply

Anonymous -uly !, 20 ! at 6"!# 1% Bro *irst time i write )omment *or any person+ really this is (ery use*ul post+ *rom heart Reply

Mutago 1ugust >, 20 ! at 2"44 $% , nearly get ma2 but your tutorial was help*ul+ anyway my system 2o not support (isualisation so i ha(e *igure2 out how to run it eB)ellently a*ter my 0 2ays an2roi2 installation )ra5y+ ,n i* anyone nee2s help, i will 2ire)t+ my installations is on win2ows 7 Reply

Anonymous 1ugust 24, 20 ! at 4"#4 1% , got error while eBe)uting 8)reate8 )omman2 on )omman2 prompt+ =rror as below, ,nput =rror " &here is no s)ript engine *or *ile eBtension 8+0s8 $lease reply i* anything goes wrong+ Reply

Anonymous September 2 , 20 ! at #"#7 1% Really help*ull ++than'u "? Reply

numediaweb .e)ember

, 20 ! at 7"22 1%

&han's *or this great tutorial+ Cou might a22 as Eenymotion to the emulator partH it is way *ast than the 2e*ault one Reply

J-Nius -anuary !, 20 4 at >"!4 $% 8)reate8 )omman2 got error " 7no2e7 is not re)ogni5e2 as an internal or eBternal )omman2+?? Reply

Michael Lo %ar)h 27, 20 4 at #"!0 1% Cou are really goo2 AA /eep on Ro)'7@ Roll goo2 0obAA Reply

Michael Lo %ar)h 27, 20 4 at #"!! 1%

http:&&'lean'odedevelopment-(ualityseal!)logspot!in&"$1"&11&how-to-install-phonegap-fo!!! "#-$3-"$1%

Clean Code Development - Quality Seal: How to install phoneGap for ndroid using !!!

Page 13 of 13

.ear -G@ius" Reinstall no2e+0s )he)' this http"//no2e0s+org/2ownloa2/ Reply

=nter your )omment+++

Comment as:

Sele)t pro*ile+++

Publish

Preview

Jin's to this post


4reate a Jin'

@ewer $ost
Subs)ribe to" $ost 4omments I1tom?

6ome

<l2er $ost

$i)ture Win2ow template+ &emplate images by enotGpolos'un+ $owere2 by Blogger+

http:&&'lean'odedevelopment-(ualityseal!)logspot!in&"$1"&11&how-to-install-phonegap-fo!!! "#-$3-"$1%

Das könnte Ihnen auch gefallen