Sicwangcisa ukubonakala kwakho! Ukusebenza kakuhle nge-ONMA scout uphuhliso lwe-Android luqinisekisiwe.
Qhagamshelana
Ukuba unomdla wokufunda malunga nophuhliso lwe-Android app, ufike endaweni elungileyo. Kweli nqaku, uya kufunda ngeJava, Kotlin, Ukuqhekeka, kunye nojongano lwabasebenzisi bomthonyama. Uya kufunda kwakhona malunga ne-Android SDK, GDR, kunye noKuqhekeka. Ngethemba, olu lwazi luya kukunceda uqalise ukwakha usetyenziso ngexesha. Ukuba unemibuzo, ungoyiki ukubuza!
Ukuba uceba ukuphuhlisa i-app ye-Android, ke iJava inokuba lolona lwimi lufanelekileyo ukulusebenzisa. IJava lulwimi lwenkqubo olukwinqanaba eliphezulu, nesivakalisi sawo siyafana neseelwimi zabantu. Nje ngeziphumo, Usetyenziso lweJava lubhetyebhetye ngakumbi kwaye luyakaleka, kwaye uze nelayibrari etyebileyo yeepateni zoyilo olungagqibekanga kunye nezenzo ezingcono. IJava ikwangumthombo ovulekileyo, okuthetha ukuba kunokwenzeka ukusebenzisa ikhowudi enokusetyenziswa kwakhona kwiiprojekthi zeemodyuli. IJava yophuhliso lwe-app ye-Android yenye yezona lwimi zixhaphakileyo zokucwangcisa uphuhliso lwe-Android app.
Ukuba ucinga ngeJava kuphuhliso lweapp ye-Android, kuya kufuneka uqonde umahluko phakathi kolu lwimi lwenkqubo kunye neKotlin. Ukuba ucinga iJava njengokhetho lwakho lokuqala, khumbula ukuba kusengaphezulu 20 iminyaka emdala kunoKotlin. Kusenjalo, kuya kufuneka uzifunde zombini ezi lwimi ukuba ufuna ukufumana okuninzi kweli qonga. Usenokufuna ukwakha i-app esebenzisa iilwimi zombini.
IJava ineenzuzo ezininzi ngaphezu kweKotlin, kodwa kunzima kancinane ukufunda. Ngelixa iJava isetyenziswa ngokubanzi kuphuhliso lwe-Android, I-Kotlin ayisetyenziswanga kakhulu. Ngoxa i-Kotlin ilula ukufunda kuneJava, lukhetho olulungileyo kuphuhliso lwe-Android. I-Kotlin ifundeka lula kuneJava kwaye lulwimi uGoogle alucebisa kuphuhliso lwe-Android. Ikwabonelela ngenkxaso engaphezulu kuphuhliso lwe-Android.
Ukuba uceba ukusebenzisa ulwimi lweprogram ye-Kotlin kuphuhliso lwe-Android app, kukho izinto ezimbalwa omele uzazi kuqala. Ngelixa ibonelela ngeenzuzo ezininzi, ifuna ixesha elincinane lokufunda. Akulula njengezinye iilwimi zokucwangcisa kwaye kuya kufuna ukubhala kwakhona iiprojekthi kunye nokwandisa. Emva koko kwakhona, ukuba uzimisele malunga nokudala app killer, uya kuba ukulungele ukujongana nawo nawuphi na umngeni oza kuwe. Enye into omele uyikhumbule kukuba iKotlin iya kwenza inkqubo yokuphumeza iprojekthi yakho ngokukhawuleza.
Ukususela ekuqalisweni kwayo kwinkomfa ye-Google I / O kwi 2017, I-Kotlin ifumene ukuthandwa kakhulu kwaye ngokukhawuleza idlula iJava njengolona lwimi ludumileyo lwenkqubo ye-Android. Olu lwimi lutsha lufutshane kwaye aluqhelekanga kwikhowudi yeboilerplate. Kwakhona kunciphisa imfuno yovavanyo olubanzi kunye nokugcinwa kwe-app, kukhokelela kwiimpazamo ezincinci kunye nokuphazamiseka okuncinci. Xa kuthelekiswa neJava, Ikhowudi yeKotlin incinci kwaye imfutshane ngakumbi.
Ngelixa iJava kudala isisiseko seemveliso ze-Android, ulwimi olutsha uKotlin wenze abaphuhlisi abaninzi baphinde bacinge ngendlela yabo yokwenza ii -apps. I-Kotlin yenziwe yi-JetBrains yaseRashiya kwaye yakhiwe kumatshini we-Java. Luchwetheziweyo, ulwimi olusebenzayo lodweliso olusebenza kumatshini weJava onenyani. Injongo yeKotlin kukubonelela ngokukhawuleza kwamaxesha okuqokelela kunye nokwenza ii-apps zibe lula ukuzigcina.
Ukusetyenziswa koLwahlulo kuphuhliso lweapp ye-Android kuvumela abaphuhlisi ukuba basebenzise ukufowunelwa ukulawula ubomi beqhekeza. Ezi ndlela ziqhele ukusetyenziswa kwii-apps ze-Android, kwaye ubandakanye kwi-Dala, kwiQala, kwi Misa, onDestroy, kwaye kwiResume. Ukusebenzisa ii-callbacks kunokwenza amaqhekeza akho abe yimodyuli, ezimele, kunye nezixhobo ezinokuphinda zisetyenziswe. Banokunceda usetyenziso lwakho ukuba luphendule kwii-callbacks ezahlukeneyo kunye nenjongo, kwaye inokudlulisa iimpikiswano ekuqalisweni komsebenzi wabazali.
Kuphuhliso lweapp ye-Android, isiqwenga sisiqwenga sojongano lomsebenzisi. Kuxhomekeke kubungakanani besikrini sesixhobo, amaqhekeza kufuneka azimele kunye nemodyuli. Amaqhekeza aphinda asetyenziswe phakathi kwemisebenzi, kwaye inokudityaniswa ukwenza umsebenzi omnye. Ukwengeza, amaqhekeza angaphinda asetyenziswe kwizikrini ezahlukeneyo. Ukuqhekeka kwenza kube lula kubaphuhlisi ukugcina ikhowudi ye-app.
Ukusebenzisa amaqhekeza kuphuhliso lwe-app ye-Android kuphelisa ingxaki yezinto ezingezo-null ze-UI. Endaweni yokwenza iziqwenga njengelifa kuMsebenzi, ungenza amaqhekeza ahlukeneyo kumba wefomu nganye. Amaqhekeza anoxanduva lwe-UI oluthe ngqo kulo mba, ngoko uMsebenzi wakho unokunikezela uxanduva lwe-UI kwiQela elifanelekileyo. Iqhekeza linokuba namacandelo amaninzi, njengamaqhosha okanye iimenyu.
Ukuqhekeka kuphuhliso lweapp ye-Android ngumba oqhubekayo. Uninzi lwabavelisi besixhobo esiphathwayo benza i-Android OS ukuba ilingane nesixhobo esithile. Oku kukhokelela kwiiyantlukwano ezininzi kwikhowudi, okuthetha ukuba iinguqulelo ezahlukeneyo zesicelo ziyakusebenza ngokwahlukileyo. Kubaphuhlisi, oku kunokuba ngumngeni omkhulu, kodwa uGoogle usebenza ukulungisa le ngxaki. Ngokunikezela ngenkqubo yokuhambelana kwe-Android, ababhekisi phambili banokuhluza ngokulula ukuba zeziphi izixhobo kunye neenguqulelo abanokuphuhlisa zona.
Ujongano lomsebenzisi womthonyama kuphuhliso losetyenziso lwe-Android lunokwenziwa ngokubandakanya inkqubo yeJava kunye neXML. Iimbono ze-Android zibonelela ngokuziphatha kolwakhiwo, ngelixa amaQela eJonga angamacandelo omthonyama anokongeza imiba yoyilo okanye indlela yokuziphatha esemgangathweni. Umzekelo, Iqela lemboniselo yePhepha libonelela ngokuswayipha okuthe tye kwisikhangeli, iyafana neapp kaGoogle. Isicelo sinokusebenzisa iimboniselo zombini kunye neViewGroups ukuqinisekisa ukuba kulula ukuyisebenzisa.
Ngelixa kukho iingenelo ezininzi zokuphumeza indlela yoyilo oluxutyiweyo, akusoloko kusona isisombululo esineendleko eziphezulu. Abaphuhlisi abaninzi be-iOS bafumanisa ukuba iindleko zokuphuhlisa i-app yazo zombini iiplatifomu zithintele. Ngethamsanqa, izakhelo ezimbalwa ezinamandla zenza kube lula ukuphumeza uyilo lwe-UI yemveli kwi-Android. Kodwa abaqulunqi be-UI kufuneka baqwalasele ukuba izikhokelo ze-UI zahlukile kwi-iOS kunye ne-Android. Ukuphunyezwa kwesiko le-Android kunokufuna umgudu ongakumbi, ngakumbi ukuba eyona njongo yosetyenziso kukujolisa kubasebenzisi be-iPhone.
Abasebenzisi be-Android banokufikelela kwizicelo ngokusebenzisa i-hardware interface kunye ne-OS's interface yomsebenzisi (UI). I-UI luphawu olubonakalayo lwenkqubo ethile, njengesikrini sasekhaya kunye nephaneli yesaziso. I-UI zizo zombini izixhobo kunye nesoftware kwaye inokubandakanya iifestile zesicelo, Amaphepha ewebhu, izikrini zosetyenziso lweselula, kunye neegeyiji kunye nezibane. Ii-UI zomthonyama zikwabonelela ngenzuzo yokusebenza ngokupheleleyo kwiintlobo ngeentlobo zezixhobo.
Kukho iintlobo ezimbini eziphambili zokuvavanya i-app ye-Android: iimvavanyo zeeyunithi kunye neemvavanyo zokudibanisa. Uvavanyo lweyunithi ngamaqhekeza amancinci ekhowudi aqinisekisa ukusebenza; iimvavanyo zokuphela-to-ekupheleni ziqhutywa kwisixhobo sokwenyani, ngelixa iimvavanyo zokudibanisa ziqinisekisa ukuba i-app isebenza njani kuzo zonke iimodyuli. Iimvavanyo zokudibanisa kufuneka zichaze ngeenxa zonke 20% yenani lilonke lovavanyo. Ukuba ungumqambi omtsha, kunokuba luncedo ukusebenzisa i-codelab yokuvavanya ukufunda ngakumbi malunga nale nkqubo.
Kuya kufuneka wenze i-APK ngaphambi kokuba uqalise ukubhala iimvavanyo. Iimvavanyo ezinezixhobo zisebenza kwisixhobo kwaye zifuna ukuba ubandakanye isakhelo se-Android, efumaneka nge-Android ADB. Ukuqinisekisa ukuba yonke into iyasebenza, uya kufuna ukuqiniseka ukuba unawo amathala eencwadi afunekayo ovavanyo. Ukuba ilayibrari yakho yovavanyo ayizibandakanyi ezi, uya kuba nengxaki yokuyidibanisa. Ngethamsanqa, iimvavanyo zezixhobo ziluncedo ngendlela emangalisayo kwaye kulula ukuyisebenzisa.
Ukuqhuba iimvavanyo ekuhlaleni kumatshini wakho wophuhliso, sebenzisa iRobolectric. Esi sikhokelo siyilelwe ukuba siqhube kumamkeli wasekhaya kwaye silandela iindlela ezingcono zokuhlekisa. I-Robolectric iluncedo ngakumbi ekuvavanyeni ii-apps ze-Android kuba ikuvumela ukuba wenze iimvavanyo kukuxhomekeka kwe-Android kwaye iyakhawuleza kwaye icocekile kuvavanyo lweyunithi.. Iyakwazi ukulinganisa ixesha lokusebenza kwi-Android 4.1 kwaye ixhasa imigunyathi egcinwe luluntu. Le ndlela, unokuvavanya ikhowudi yakho ngaphandle kwe-emulator.
Zininzi iitshaneli zentengiso yeeapps ze-Android. Eyokuqala nephambili yiGoogle Play. Le ndawo yentengiso yeyona inkulu yohlobo lwayo kwaye ivumela abaphuhlisi ukuba basasaze usetyenziso lwabo ngeendlela ezahlukeneyo. Ukongeza kwi-App Store kunye neGoogle Play, I-Android inamanye amajelo osasazo ambalwa. Ukuba i-app yakho ijolise ukufikelela abona baphulaphuli baninzi, bekuya kuba yinto entle ukuziphonononga zonke. Kukho nezinye iindlela ezahlukeneyo zokusasaza iapp yakho, kuquka iimarike eziphathwayo ezifana ne-Amazon App Store, iTunes Store, kunye nePlay Store.
Nje ukuba usetyenziso lwakho lwe-Android lugqityiwe, ungasasaza kubavavanyi bakho. Yale, kuya kufuneka wenze i-frontend elula eya kwenza abahloli bafake usetyenziso. Nje ukuba abavavanyi bekhuphele i-app, kufuneka basayine kwiiakhawunti zabo okanye bavule i-imeyile kwizixhobo zabo eziphathwayo. Oku kunokuthatha ixesha elininzi kwaye kuya kukhokelela kutshintsho olulahlekileyo. Kungenjalo, ungasebenzisa ukusasazwa kovavanyo lweqonga lomnqamlezo.
Olunye uncedo lophuhliso lwe-Android app kukuba kulula ukwenza ngokwezifiso. Ngenxa yokuba i-Android liqonga elenziwe ngokwezifiso kakhulu, abaphuhlisi banokuyilungisa ngokulula ukuhlangabezana neemfuno zabo zoshishino. Ngaphezu koko, kunye ne-Android, akukho qonga lilodwa lokuhambisa, ke abaphuhlisi banokudala amajelo osasazo amaninzi kwiiapps zabo. Oku kuthetha ukuba banokufikelela kubaphulaphuli abaninzi ekujoliswe kubo, oluyinzuzo enkulu kulo naliphi na ishishini. Kwaye, kuba iqonga ngumthombo ovulekileyo, oku kunika abavelisi iinketho ezininzi kunye nenkululeko yokwenza usetyenziso lwe-Android.
Nceda qaphela, ukuba sisebenzisa cookies, ukuphucula ukusetyenziswa kwale webhusayithi. Ngokundwendwela indawo
ukusetyenziswa ngakumbi, zamkele ezi kuki
Ungafumana ulwazi oluthe kratya malunga neekuki kwisibhengezo sethu sokhuseleko lwedatha