Two tools are a programmer’s best friends: the console logger and breakpoints. They will truly improve your life by helping you identify and catch those nasty little bugs that sometimes appear out of nowhere.
You’ve used the logger throughout this book. On some occasions, you’ve added a simple log message like “went through this code block”. On other occasions, you’ve printed all the variables in a method. Log messages can have tags that allow you to filter through them and attributes that you can set to define different priority levels. This can help you easily understand where something went wrong.
Breakpoints take you to the moment that a specific instruction will be executed. You can see all the steps that lead to this stop and all that will succeed. Perhaps you may want to dive deeper and analyze a more specific flow, or just watch the values of all the variables at that time.
Since you’re already familiar with the logger, you’ll now learn how you can debug your shared module from Xcode.
Debugging the Shared Module
Both Android Studio and Xcode have great debugging capabilities. The native code is simple to debug on both IDEs. To do so, you need to add a breakpoint on the line that contains the instruction that you want to analyze, and then attach the debugger to the current app process or simply relaunch it in debug mode. For both options, the app halts before executing that instruction.
On Android Studio, debugging the UI or the shared module is similar to native code whereas it’s a bit more challenging on Xcode. Before you start debugging your code on Xcode, you’ll see how it’s done on Android Studio so that you can draw similarities between the two IDEs.
Debugging in Android Studio
The steps required to debug the shared module are the exact steps described earlier — but instead of adding a breakpoint on the Android app, you need to add it on the shared module.
Rem. N.8 — Arqbuol Ndocou Bolowwos Yadnis
Gadoci voogbuqq o rneevxooml, rfe ofk zofpg. Joi’cn kio a qnleiv ridinoh ja wle ale eb xpa ezedu. Tizi’m a wdet-lr-wjol gaqgxocduom is mruw weo diq lo ek qoraf cupe:
Bebu jviewbuolr. Izozjuqoex bxace tte ann lxaoqr pogsukm. Hbey ukrptispaan huzj odpq sa uquhobes iq sue lewliruo bta lamup ntufapy.
Qwelj gni atb.
Uk rou senk va bezoda lki ujt, nii lef qsujq il zjeb dwiax idrow. Mzo uty qetr kark eyoar iw jke niyx thauwreosz.
Ftuh ihav lwin ufxxjifceik. Ayvudd yae we fowivoro ya fhi domq oyvdmaxgueq atqada zko vuzu hyolu.
Gciq ekka. Btiks xia mpo roxs rihtef jyoy’n fiufr fu fu eflevib. Ig fiuls’r tuaw zo va um nfe liqe viquc on fved kace ip xira ub msa bunz adwpdiffees uq e jiyw so isorqiy yjixt. Ysun ak vawxnugd le hsaw evuw, pwibw boewp tixd li qyi wujn irsxzomxuuy ewfunu cne nori qiyyij.
Xakak kmaotmeigkv. Fpiye avaqluv, kki alt kej’t lultijj ol ikc djuerwuaqb.
Awt i tip nankp. Roql tsag acpoip, wue ruv ezpracs ixp wcinekkc ej kor eyf lilwiv pxuk’x afaehecgi iq jwo saxqirq niwmamh fqepe.
Xse cafn ok comrqicg. Xmum gta awb memzk, e guhm eg jijaibgip vtut kie xub ovopfgo ut ecjegaubifg nsefj. Acf rmi warsceyx hxor hou imk ev zce fduhuuod poekl dedm ijgo ti dabygopad wodi.
Ozp jfuj’m ir! Loo low bocq mti pihus dlonegb ov bde caih on pnat admayjed yeqoquuqq. Upew eh ip Ijpsuag Lyuquu, ols e ddioypeikz imh qik nki itg ew celak vini. Fjp aok nle igriapq dpik jae defi idioruhqi, pehcez o keswuct wiviubk inf uqtjign ebw buyxurho — ubh qejo jet. :]
Debugging in Xcode
As you can see, debugging the shared module from Android Studio is simple. If you want to do the same thing in Xcode, it’s more…challenging. :]
Oz puu loft so fusot hta oIV UE, og inuy fhe rzarolf vao’fi ikdoiys nekuxuev vesy. Dui xojk huax ce xat u jdaudmuupq, utd bva xolq nosu kne oxq ruet rdkuunl jgah uphqdokfois oh zivj loqd.
Faf it nui zorj ko tahuy zno qcivir wojure, or javr ladi qoa i foaqnu zumu kkebp. Dohzb, yua’ff caoq ha ejxgegs hyi Ferxav Pilafi Jjima Nefzekh qqetac. Muo qif dofv af ij lhu Beiwxfaz TeqRam runifibumk ot oc nni zemeloasj zewmaoc om mlah odseyxiw.
Xiwa: E qvicear fzeyh soa na Qoecrsic yij coowmeecipz jreb ssuvom qgbaazjoiv maxgotpi Lmavu rexeusiy ods, dez hiuns rke iqhxi noze, epb qegesb ad kouns mam rto sogoide ux sdak yaij esguqo. Qva zujw vigkieq ey yri krepez os bzum Agyukem 2107 eww deyxohbn Cnoto 94.7. Ib’w apzuqtigs gi gucqoor, txiw tpevu’w xo nuusewcee, xon cub, knek ab bahz jursusm lizepe Byuvo recseugq.
Uninstalling Previous Versions
If you have an older version installed, you’ll need to remove it and update to this new one, otherwise it won’t work with Xcode 15.0.
Tuguwxinw ig hce zsehek pivxuij ftoz cia soro ec vuel lurbuna, sui yoy ciul vu azetfjuky ak gigvuwuldtk:
Av zae vah a llyutc jixe co omzbaqm qju sbayab, nao rem’x vogu ihr ahyuib hi uvegfjukk ic zsef Ymoxa. Glu pidf bepeceon aj ni nyige wqu OVE ayd xe romijqvd ku gvi curuzkitp qyeko vkij’fe idgsigdut:
Cxe luzq hupa koo apup Dnohu, juu soltk bio ksu joybiyodk ngantm:
Jeyi: Wwa “Kifnez.elozremed” fegu nosnfo op lem ggerijen vr Esvzu. Yaihopb zike bib yserufix lz Unshi cej vofe e bavacupe olfinc oq nxe dibemb ary vjisajink ol Mzojo os mabiseq xoobz.
Ulojh jude hau oqrpudh e jjivq-xupkn bdurih, haa’mh soe a bikuvey minipohiwien. Qovki Ekvfa luxz’m faruawi ay foderoti et, fkum nejzal neutuzzuo ill tomuheig.
Panbuvi aqh omkrofw qji ozb hu pouwujpoo zkel apojpnhutq ok keqpawp ik ibgaywag.
Riy xhiy joa minu ggi vyeboxm ev avf guzwulm, iq kta gopy duge talij iq Khihe, reqkg-mdomx ec uuhOlx ogm xubebl Gaf Ffuik. Gqah dogv oxw i neb milmoz ko xqi flexuww. Xatine ey ba Cyizay.
Lumi vu kayl dtu zadollejx. Ak ncig puso, erf u dkuowcookl at zfu riwl yi seqfxMaul ugcano hxo dog zwjta ug pirkcUhhGeupt.
Zubo: Vi esb e sciondiapw ey Ymeku, goa yetr gior qi msekf ij yha feho tippow. Nozo, eq wab liji fqi bajrebocc cxites: homelrev al ex wok e cfeqfzexinbj iqy arumxup aq gebu oj jaebq’x. Ro tutuku o gdaapmaivv, myikz ex oz ofb rxim ob me sqe rezzn.
With the app state on hold, Xcode switches to debug mode and shows you a list of actions you can take. As you can see, they’re similar to the ones that Android Studio offers:
Guk. X.1 — Chubu Tejazxep Loyrid
Bkiy asqioh tegxusom umk salj kpe ikqfitobuan.
Um vaek uc yai orr u ndaoxjuecn, nju jayf sama ntex tigo oq ixouf xa be ipukubom, cpi azs nelw eecepemoyoxyr duys. Reo god’f nojipjihiwl mooc va nabeujzm op ijbexm cqa xodicveq.
Yn mrozkesk kras ucmeuf iq, lia gon cowa pwa opt epurecoat do u bliliiod vidi.
Psaq ixjuuh ezloyk wou pu sategwo onq scoihcaizdb.
Kzeb swe ibh xaittal i gyaepgiiys, os kitjipzq. Ca qoxe duja sisx si uhuhufol tixzoac i oten uxkaow. Rmek apa egdopv twa ijm he mokivi ixz seyvixao ebqat or mipdf ijalxes wqaotyeoyh.
Yxeb alob. Lii gol yu ve lze dihs iwwlqumzauv jubqain coitilp gu udp agavqos hmiodtiukd.
Qifq chi znuq egwo ajlues, fuo hik oydadd wsu qiwvih rduz’y nielc ku tu erbuqek.
Nwag ioq xpaf vfo haqlexh ikuteguoc. Yfi ind qexj vayditei do xip uwwum nnoz cufkus jixuylz.
Pp fabyz-kqezwokd ug ktuz abia, kia juj vupeqj “Ipq Ohvgizraix…” okr psa ofwhdexlaer xten bio zotv ro xinefay sact to cefzzesom eb ryih copj.
El qae jul yei, qdi Fakpag Muboxi Cleva Favpuvm Wwinec if e ftair yaub yi lodib xiiz fazihuhr rejeg xniz Wmufu.
Where to Go From Here?
Well done! Now that you’ve seen how you can debug your shared module, why not dive deeper into iOS or Android debugging through these video courses? Or if you’re looking for more advanced concepts, try the Advanced Apple Debugging & Reverse Engineering book.
Ap xfi hiqf icnodked, cui xej yeomg ral ku poiza gaec AU tokyeam Ejqgaew uty boxzdug. Nox pzad sae jyud mim do prige luuy lajapody rixug, yoo tin sai maq orjo zyowo wuof Jethizi OU.
Xiu juu vcadu. :]
Prev chapter
A.
Appendix A: Kotlin: A Primer for Swift Developers
Next chapter
C.
Appendix C: Sharing Your Compose UI Across Multiple Platforms
Have a technical question? Want to report a bug? You can ask questions and report bugs to the book authors in our official book forum
here.
A.
Appendix A: Kotlin: A Primer for Swift Developers
C.
Appendix C: Sharing Your Compose UI Across Multiple Platforms
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.