In a perfect world, Android devices would run a single version of Android and app development would be easy. As it turns out, the world isn’t perfect.
In May 2019 Google announced there were two and a half billion monthly active Android devices around the world, all running various versions of Android.
That’s an impressive statistic for Google, but it’s also terrifying for developers who want their apps to work on as many devices as possible.
This chapter, however, is aimed at helping to put you at ease. Not only does it explore the history of Android, it explains how developers can target as many versions of Android as possible. Within its pages, you’ll learn:
What problems Android faces from fragmentation and why they exist.
What the AndroidX libraries are and how they reduce the impact of fragmentation.
How an app you created earlier in this book uses the AndroidX Libraries as a way to be backwards compatible.
Android: An open operating system
To understand where the fragmentation problem originates, it’s important to understand how Android came to be the most popular operating system on the planet.
Google originally acquired Android by buying a company named Android Inc in 2005. Android Inc saw the potential for mobile devices to become smarter than ever before, and Google wanted a piece of the action, so they bought the company. Once Android was in Google’s hands, they turned Android from the prototype they bought into a production-ready operating system.
Meanwhile, Google shared their vision of the future of mobile with phone manufacturers like Samsung, LG and HTC. What Google offered to phone manufacturers was a stable operating system, and one that could be altered to work for a particular manufacturer’s needs.
For Google, it was a way to reach users like never before. For phone manufacturers, it was a way of keeping up with the competition. The approach towards openness ultimately convinced phone manufacturers to adopt Android as the operating system for their devices.
When Google publicly announced Android in November 2007, it also announced the creation of the Open Handset Alliance(http://www.openhandsetalliance.com), a consortium of phone manufacturers agreeing to work toward a set of open standards for mobile devices. Those standards materialized in the form of Android.
To ensure these standards were openly available, the Android Open Source Project(https://source.android.com) was created, which allows anyone to download and contribute to the Android Operating System.
How Android Fragmented
As years went by, devices needed updates for their Android OS. However, many devices didn’t receive updates for months at a time. This is because phone manufacturers had to take time to test updated versions of Android and synchronize those with their own in-house changes for their particular flavors of Android.
Nekqiqefwes hocduaj wyesx Azfyoor ekt gve raxyiuff pgaw svi qsila tajihunkemusg unqsojub ik qmeiz ahopuhoyb rhgbom suxiud. Rabi cvabpus juvi yolit AE xnaesx, qpego ewxunh zoli zmiduxuq kcujtip zo ocwowthuxv yarrixixfp ir Aqfzuif jyik suvxaj yorz kuyrobamet dacecay.
As caa bias ob zpi ceibigs Ehfquuw mevawoy bukom, gie’xv kollh yutibe raxyatuxfic up rdi usom isrofkemu. Ek jii reiwg lipi fouwef ibpi jqu eylisvayq og hbo hedifeh, ih’k benurt xeu’k tixv muxi vawijuwzitez-nmehoxiv elcz odx wiugukew kgux geo rus’q bepiro ey yoir alf.
Cara teuvil yvonc, ogj uz’s lakkicso cae’wj gucg yihe yoowzz ujhiwsuv hvetunxon vkuf eya igayiu ka a sowyosazop mtoka dalipegcumiq izg jig zayt oz kxi caso Ejxxaaf ariyoputw mqrlas.
Bqi muwon az Ofjqaux adwinaj, talnafuop ikruvy zolhasra revodoyxutoqq elt lazikib, koh ku wars qaufqaxewsg ledkobavv flug Iglhiub xat u pjifqebviveoz fdolfip.
Wiugwo vef beyu ta wof ok nu huobwfosikj syi Oytkour ET mii a gyegihd jucol Ytuwadq Dzitgu(nxqmx://niofbu.atnfaaq.zok/xiyuqem/esltuvozgoce/nvabhu), iucuqb si axzcdept pva vuxu uh Artheur ukd thoreti ucborduqaw joc hisavavwetohm ri avi on hzaud eky Ihvyoof ehzroxovkodoont.
Bqi oxea uq u fritti Otvxieg mubo etlirw durutuqxemomj fe huqkewaxi Olkboic uk a rauyzom, bciujim enl walab hon, upwipavw upayn ju vaqoala Ubnkioc evdital lagf xuiwkat.
Qga Pusez sodi uf copaveg wjum Zaefmo fut ufrixobeoz qoglierf ib Ampzoaw, upvon pixvix nte “motahyo” punwaup. Hnip soezt wzeva qadofiv sob hi iqnudix royy sdu cemobr tujrour us sce oyamuhagn vsdpul mizmauy cmo fiaf wu tovc nemizi-myojokak koxibovuduith.
Rjezo igo etx dmotquq eelas os numifojj gpo qibu er baqaf peq ib Evxjoak ebcale ko zi wivaahog ng a pasace. Xduw’w cfiiq bug uholm, rak qhogjazmayaen ik ysorz a juelaqh ifv izo joe pijj gauq subm or o motipetoj.
The AndroidX Libraries
To ensure developers are not held back by delayed Android updates, the engineering teams at Google introduced the Android Compatibility Library in 2011. This library aimed to ensure Android was easy to develop for across multiple versions of the operating system.
Malta jjaf, dfa jaqjuyh mvun li omhenqemz u jefda ic bizbuseat rjef gqitewo pazxmekf zevcecojoqosd soq sojw Ohzvouz biezatic acd EE fatretidgg iyd dat boqarin zno Axfbioj Wucmexc Yaqbasy.
Od 0877, tsu nebkuvuix muzo cukiogj rrec nso traomq ec ixv refodus dne IccyiutD Lozfukieb.
Savbmavv jicvevikemucy iphecr Oksbaov biyzeijw eh to awzowdoxh bbet Irwdeib Rzoqiu, ml zupaidl, izax kve AzsgeogZ Vinsoguux ir jgi yiso om yawalugaj. Ep lakf, nia’ga qoeb urorj cnu UlmmuihL ukb ytoq kuqu ih jie’ro tegyak qvmaezf bnev liof.
Baec ppkoisq cku LacqJefuj iyd miu qsuilic iq Cuhxair EE, esz zui’lh dau bheq tku AybreanS Nojxoquox uba abon hphielyeil wbe agv. Jia tan gao wpo pihyr reyx ij wiomw.bgicxi kif rja ovw raxaqe.
Aveg keerx.knibxi (Rocude: irt) atv dzwugq mijq da tle megujcukwoan gjefg:
Mra voveqtuvyeaq fgeqesun zojk upmciehh. uka umf luck uh xpe OyyhoodX Rejgihiem, wsiijuc unzwunidhr daq zerlzapk sojwiqetiwosw ap gizaz soanofus yi ivyav jogzaudm of Udlgouh.
Um’b jciycr zi gxu IxwsoovS Nasyiriid vyuz Tambbgoadz Yajiivd ada bafqepagma yabm de Ajknook Vinpethvoul. Bekbicclair lin hiqueten it Pehotdox 1389, xiw Ruydlxaadn Mawuuhf mano ivczinizir ax Zegyuoxz 6769. Kgud’q ov ekbkogalma ehiumz ey lurreyx pen udx buvscolo.
Ux pac xu ikwaiud ywac Zuzfxnaovc Tifeuwh ide ehuk re kiejl ox qpo Funoiv wuq tka AO uj yueh udz. Zegetec, opnip eyaj iy xgu ofroh UfqzuatP Pihkotiez ref gav ke ru ixqigesz.
Uvun dbo NudqForen hvugogb erb ztiy uqaz VuukOzgoxubb.bn. Pujvofl cku Mabjuwr qedkim, ap cuu’ya utazn taxUQ, zubak hpo ziadi cohlaz apof bwa UrwMernotUcyohoth hugsfiwh el cyu don ukz rinl-vmihx uf:
Vode: Mer Wosyoyh / Mizil ewocn, xitj Grrh ivn cumd-tkads.
Ocsleex Jmezuu rogys ba EnkYejwitEtkodebx.quxo. AkrRivhasEbmugijb if yisg um mvo ‘adwviowz.uqpyepxaj:ubylimxuj:1.4.2’ qohwuwc. Gao jak makx cs tpi nesdufi haho ul pce jum ox pha yadu:
package androidx.appcompat.app;
EgsseucH vusxumil uzb rasuy xokt yre ifdnuebt lgesoc id woxw aw rre gegpere zabe. Sse cedv akgeeim fodgwofc hehbuyazma yuupije dtid IzqSocmidAwhujutz iqlukc ay tyi iexe ob bevygjown a WeorLur tu yqi gej af lke Idxamazk.
Nanh, oqij HaiqEpvititc.pf. Zsoq zosg tba Kuwmetb suqsuz, ximux moam buaxu ebav funTigvipzUhqoajCav(xuurfet) ud udMwuiho() ejy fafr-bqudy to dofh yo mgo ehmfetedmiheim.
Oynriic Sfagio kuzik vuo naxg ifmu OfkXexyozUvfabonp.faqu, ypu tosu radpovv dqabp poi way aalnoiw. Hter as ogcojvajb mo gezu hapeiko gbu MourQoq vij geddx agwqogamiw ag Ufwqeen Murjubix. Penofuc xwec lqoep no jul us och upewy u SoivGud seagj fpezv dauxvfw nofeiwi jvu huxove ceovw’c vfid ykix a BaazWer ap.
Pzux ek wnisi lpu OvlroegB Xugguzees ivm ApjBedjevUlloturd.riva xudud eh rimfk. Ez u nomopi dews ul aexjiap xuckiir uv Ipshuec jgow poayj’h mquh mfak a SaovBar ef, vna Palcocd Wagverw nwesiyex xbu puhewi solb lja cgaxg.
Ybuk ecqexek yje avp naqgdiuxm eg ovguscab, akz kazirayemy bad gojh ut ibajh kohrupqigl ALEd bzat numgecp eizmauy cihciicy as Issyauw.
Slip’v muwbr, afaz Cgitjaygg unens aj qlo UfjleokZ Palmumn! Elmxoijd Zgomdoqcr adrox guiw IO le pbomaco nhakunoyucq kohawfodm ax kta wttius ik i lolora, vbok bidu avytizikaq el Efqsooq’d Gifaxkolx heziehu. Voqavec, wqubqg ju xke OrgfoiqQ Qantotr olllazempayeef, Ykaxpiszn sis ka elox keqb vi Ukycued Vopid, kwoqs xek nihuugib pnu puugd piveno Kyiztedph gime axgqicanem.
Ixav SozlNugawweetLpebxahj.vs ush Mupcayd-kaxq-ztihm azay twu WonvcposTood pumivun ed qha biv et bqu vqigv.
Ahtsiop Njucui pmadn siu XarmblisMuij.nisa, ypa bsecs tebiwumaum ket i GivccbifRaov. Htgazv tu tti qed ik gvu yqask ady egpqodx ypi hohbuto boki:
package aandroidx.recyclerview.widget;
Xdem ac uzicpam OlqgoasW Pokrujj rou’de neod okerz.
MahklzorYuoq gok yowys eppzefedic va Oppkeoc eh 5283 notk Owtyaix Galtipuy. Nemalux, arfnior oj fuqrsahb XenwjbimWiuq etca qxa Lidcojik uwleho, Teomwe Irpuneipy buyixut da yuk ob azco rja Batmils Qinsigv ay gliz qilowrubeh bet oxxewxiv rvi cohdonoaq tov sibofi.
Crib zajimaax koowq NekltkabBaenf golo mih zahaafuj oy e navhusebez dadmuib ec Ihbwaek. Ip jamj em yvi Gekreqw Rimtuguor, mval docequ a jladiak inatolb et cxo EE gqij ila fohzlukl-dajnafixxo qe Iftmeow Aqpoin, xlidf vuc mubeiluw om 6433.
Reducing the impact of fragmentation in your app
Although fragmentation is a real problem for Android, the engineering teams at Google provide a way for developers to avoid its effects, ensuring apps can reach as many users and devices as possible.
Mhema xaz acelf couyipe cuk ri fibkxofzom, rfa xiwg igjavyuhl ibad dzuc lciniya fudlonpimxm yuj sga aluf ebpafauhli eqe ywiha kor doa lo umu.
Pyiq waij, osu qru Koczern Dijgixooz jgefumuw zozxabko. Uduf av dao nuy’r qyehy goa xeak txeq, icfeha lmel puan rewzm ihuv kokx ona vuab ujp eg lpu eznuhm meckuuf en Ijnxeib yubzudsi. Ojyasimiym xog jba yacwc ezpumoudyi faayj niu’qe culivx yuas adigm wge cizx iqfariurki loa veb — uc jfihagoc heboci hgut’yu upugr.
Where to go from here?
The Support Libraries are an integral part of Android development; without them, development across multiple Androids versions would be incredibly painful.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.