%3CLINGO-SUB%20id%3D%22lingo-sub-1094422%22%20slang%3D%22en-US%22%3EUsing%20Azure%20DevOps%20to%20create%20a%20CI%2FCD%20pipeline%20for%20an%20Android%20application%20built%20with%20React%20Native%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1094422%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Ftag%2Freact%2520native%2Ftg-p%2Fboard-id%2FWindowsDevAppConsult%22%20target%3D%22_blank%22%3EIn%20the%20previous%20posts%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3EI%20have%20written%20on%20this%20blog%20I%20have%20talked%20about%20many%20specific%20tasks%20related%20to%20React%20Native%20for%20Windows%3A%20how%20to%20build%20a%20native%20module%2C%20how%20to%20setup%20a%20CI%2FCD%20pipeline%20on%20Azure%20DevOps%2C%20etc.%20However%2C%20one%20of%20the%20advantages%20of%20React%20Native%20is%20the%20ability%20to%20target%20multiple%20platforms%20leveraging%20the%20same%20codebase%20and%2C%20at%20the%20same%20time%2C%20achieve%20the%20same%20quality%20of%20a%20native%20application.%20This%20is%20made%20possible%20by%20the%20different%20render%20targets%2C%20which%20translates%20the%20various%20JSX%20controls%20into%20native%20controls%20of%20the%20platform%20where%20the%20application%20is%20running.%20And%20thanks%20to%20native%20modules%2C%20we%20can%20also%20build%20plugins%20which%2C%20under%20the%20hood%2C%20use%20Android%2C%20iOS%20or%20Windows%20APIs%20to%20perform%20a%20task.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20such%2C%20after%20having%20successfully%20built%20a%20CI%2FCD%20pipeline%20on%20Azure%20DevOps%20for%20automatically%20build%20and%20deploy%20my%20React%20Native%20project%20for%20Windows%2C%20I%20decided%20to%20move%20to%20the%20next%20step%20and%20build%20such%20a%20pipeline%20also%20for%20the%20other%20platforms.%20The%20goal%20is%20to%20have%20a%20Windows%2C%20Android%20and%20iOS%20application%20automatically%20deployed%20every%20time%20I%20commit%20some%20code%20to%20the%20repository%20which%20hosts%20my%20React%20Native%20project.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20start%20to%20see%20how%20we%20can%20add%20Android%20support%20to%20our%20pipeline!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22welcome-gradle%22%20id%3D%22toc-hId-1061355163%22%20id%3D%22toc-hId-1061355165%22%20id%3D%22toc-hId-1061355165%22%3EWelcome%20Gradle%3C%2FH3%3E%0A%3CP%3EIf%20you%20have%20ever%20tried%20to%20deploy%20your%20React%20Native%20application%20on%20Android%2C%20you%20should%20already%20have%20met%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgradle.org%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EGradle%3C%2FA%3E.%20It's%20a%20very%20popular%20build%20automation%20system%2C%20widely%20used%20for%20Java%20projects.%20You%20can%20think%20of%20it%20like%20MSBuild%2C%20but%20for%20platforms%20different%20than%20C%23%20and%20.NET.%20Exactly%20like%20MSBuild%2C%20Gradle%20allows%20to%20setup%2C%20trough%20properties%20and%20configuration%20files%2C%20complex%20build%20systems%2C%20which%20require%20additional%20tasks%20other%20than%20just%20compiling%20the%20source%20code.%20This%20is%20the%20reason%20why%20React%20Native%20uses%20Gradle%20for%20the%20Android%20platform%3A%20it's%20able%20to%20perform%20all%20the%20tasks%20which%20are%20required%20to%20bundle%20and%20package%20together%20the%20JavaScript%20files%2C%20other%20than%20just%20compiling%20the%20Java%20code%20into%20an%20APK%20package.%20When%20you%20run%20your%20React%20Native%20project%20for%20Android%20using%20the%20following%20command%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-13%22%20class%3D%22language-powershell%20hljs%22%3Ereact-native%20run-android%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3Ethe%20React%20Native%20CLI%20will%20run%20Gradle%20to%20build%20the%20APK%20and%20then%20it%20will%20launch%20the%20Metro%20packager%2C%20so%20that%20you%20can%20have%20a%20live%20development%20and%20debugging%20experience.%20If%20you%20use%20the%20React%20Native%20CLI%2C%20instead%2C%20to%20generate%20a%20release%20package%2C%20Gradle%20will%20generate%20a%20bundle%20first%20and%20then%20it%20will%20create%20a%20standalone%20APK%20package.%20It%20isn't%20a%20very%20different%20experience%20from%20what%20we%20did%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fappcenter%2Fbuild%2Freact-native%2Fandroid%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ein%20the%20previous%20posts%20for%20the%20Windows%20project%3C%2FA%3E.%20In%20that%20case%2C%20it%20was%20MSBuild%20to%20take%20care%20of%20everything%20for%20us%20and%20to%20generate%20a%20MSIX%20package%20with%20all%20the%20required%20files.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Android%20build%20process%20is%20controlled%20by%20a%20file%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%2C%20which%20defines%20all%20the%20tasks%20that%20must%20be%20performed%20during%20the%20compilation.%20Gradle%20support%20a%20scripting%20language%2C%20so%20you%20can%20define%20variables%2C%20read%20properties%2C%20add%20conditions%20and%20logic%2C%20etc.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20case%20of%20a%20React%20Native%20project%2C%20Gradle%20leverages%20two%20different%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efiles%3A%3C%2FP%3E%0A%3CUL%20id%3D%22pragma-line-24%22%3E%0A%3CLI%20id%3D%22pragma-line-24%22%3EA%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eandroid%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder%2C%20which%20is%20the%20top-level%20build%20file%20where%20you%20can%20add%20configuration%20options%20common%20to%20all%20sub-projects%2Fmodules.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-25%22%3EA%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eandroid%2Fapp%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder%2C%20which%20instead%20contains%20the%20various%20tasks%20and%20properties%20which%20are%20used%20to%20generate%20the%20APK.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EUnderstanding%20the%20basics%20of%20Gradle%20is%20very%20important%2C%20since%20we'll%20need%20to%20make%20a%20few%20changes%20to%20the%20default%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ein%20order%20to%20make%20the%20project%20suitable%20for%20a%20CI%2FCD%20pipeline.%20Let'%20see%20them!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22create-a-signing-certificate%22%20id%3D%22toc-hId-1751916637%22%20id%3D%22toc-hId-1751916639%22%20id%3D%22toc-hId-1751916639%22%3ECreate%20a%20signing%20certificate%3C%2FH4%3E%0A%3CP%3EExactly%20like%20we%20did%20in%20our%20Windows%20application%2C%20also%20Android%20applications%20must%20be%20signed%20with%20a%20valid%20certificate%20in%20order%20to%20be%20installed.%20As%20such%2C%20the%20first%20step%20is%20to%20create%20a%20private%20key%20that%20will%20be%20used%20for%20this%20task.%20We%20can%20do%20it%20using%20a%20tool%20which%20comes%20with%20the%20Java%20SDK%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ekeytool%3C%2FSTRONG%3E.%20If%20you%20have%20the%20JDK%20installed%20on%20your%20machine%2C%20you%20will%20find%20it%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EC%3A%5CProgram%20Files%5CJava%5Cjdkx.x.x_x%5Cbin%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder%2C%20where%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ex.x.x._x%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20JDK%20version.%20If%20you%20have%20Visual%20Studio%20with%20the%20Xamarin%20tools%20installed%2C%20you%20can%20also%20open%20Visual%20Studio%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETools%20%E2%86%92%20Android%20%E2%86%92%20Android%20Adb%20Command%20Prompt%3C%2FSTRONG%3E.%20This%20option%20will%20open%20a%20command%20prompt%20with%20the%20JDK%20path%20included%20in%20the%20global%20paths%2C%20so%20you%20will%20be%20able%20to%20invoke%20the%20keytool%20command%20from%20any%20location.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERegardless%20of%20the%20option%20you%20choose%2C%20this%20is%20the%20command%20you'll%20need%20to%20type%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-34%22%20class%3D%22language-powershell%20hljs%22%3Ekeytool%20-genkeypair%20-v%20-keystore%20my-upload-key.keystore%20-alias%20my-key-alias%20-keyalg%20RSA%20-keysize%20%3CSPAN%20class%3D%22hljs-number%22%3E2048%3C%2FSPAN%3E%20-validity%20%3CSPAN%20class%3D%22hljs-number%22%3E10000%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ETwo%20parameters%20can%20be%20customized%20here%3A%3C%2FP%3E%0A%3CUL%20id%3D%22pragma-line-40%22%3E%0A%3CLI%20id%3D%22pragma-line-40%22%3E%3CCODE%3Ekeystore%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edefines%20the%20name%20of%20the%20file%20that%20will%20be%20generated.%20The%20previous%20command%20will%20generate%20a%20file%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Emy-upload-key.keystore%3C%2FSTRONG%3E%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-41%22%3E%3CCODE%3Ealias%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edefines%20the%20alias%20that%20will%20be%20assigned%20to%20the%20key.%20The%20previous%20command%20will%20generate%20an%20alias%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Emy-key-alias%3C%2FSTRONG%3E.%20Feel%20free%20to%20replace%20it%20with%20the%20one%20you%20prefer%2C%20as%20long%20as%20you%20note%20it%20somewhere%20because%20you%20will%20need%20it%20to%20perform%20the%20signing.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAfter%20pressing%20Enter%2C%20you%20will%20be%20asked%20for%20the%20following%20information%3A%3C%2FP%3E%0A%3CUL%20id%3D%22pragma-line-45%22%3E%0A%3CLI%20id%3D%22pragma-line-45%22%3EThe%20password%20to%20use%20to%20protect%20the%20certificate%20store%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-46%22%3EFirst%20and%20last%20name%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-47%22%3EOrganizational%20Unit%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-48%22%3EOrganization%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-49%22%3ECity%20or%20locality%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-50%22%3EState%20or%20province%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-51%22%3ECountry%20code%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThese%20information%20will%20be%20used%20to%20generate%20the%20subject%20of%20the%20certificate.%20For%20example%2C%20in%20my%20case%20the%20generated%20subject%20was%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-55%22%20class%3D%22language-text%20hljs%22%3ECN%3DMatteo%20Pagani%2C%20OU%3DAppConsult%2C%20O%3DMicrosoft%2C%20L%3DComo%2C%20ST%3DCO%2C%20C%3DIT%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EOnce%20you%20have%20confirmed%2C%20you%20will%20be%20asked%20for%20the%20password%20to%20protect%20the%20key%2C%20which%20can%20be%20a%20different%20one%20or%20the%20same%20you%20have%20previously%20used%20to%20protect%20the%20certificate%20store.%20At%20the%20end%20of%20the%20process%2C%20the%20tool%20will%20create%20a%20file%20in%20the%20same%20folder%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Emy-upload-key.keystore%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewith%20the%20private%20key.%20Make%20sure%20to%20store%20it%20in%20a%20safe%20place.%20We're%20going%20to%20need%20it%20later%20to%20sign%20the%20APK%20as%20part%20of%20our%20pipeline.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22setup-the-signing%22%20id%3D%22toc-hId--55537826%22%20id%3D%22toc-hId--55537824%22%20id%3D%22toc-hId--55537824%22%3ESetup%20the%20signing%3C%2FH4%3E%0A%3CP%3EBy%20default%2C%20React%20Native%20signs%20the%20generated%20APK%20as%20part%20of%20the%20build%20process.%20We%20can%20see%20this%20task%20in%20the%20second%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%2C%20the%20one%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eandroid%2Fapp%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%20Open%20it%20with%20a%20text%20editor%20of%20your%20choice%20and%20look%20for%20a%20section%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eandroid%3C%2FCODE%3E.%20You%20will%20find%20the%20following%20entry%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-64%22%20class%3D%22language-java%20hljs%22%3EsigningConfigs%20%7B%0A%20%20%20%20debug%20%7B%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-function%22%3EstoreFile%20%3CSPAN%20class%3D%22hljs-title%22%3Efile%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-params%22%3E(%3CSPAN%20class%3D%22hljs-string%22%3E'debug.keystore'%3C%2FSPAN%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20storePassword%20'android'%0A%20%20%20%20%20%20%20%20keyAlias%20'androiddebugkey'%0A%20%20%20%20%20%20%20%20keyPassword%20'android'%0A%20%20%20%20%7D%0A%7D%0AbuildTypes%20%3C%2FSPAN%3E%7B%0A%20%20%20%20debug%20%7B%0A%20%20%20%20%20%20%20%20signingConfig%20signingConfigs.debug%0A%20%20%20%20%7D%0A%20%20%20%20release%20%7B%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-comment%22%3E%2F%2F%20Caution!%20In%20production%2C%20you%20need%20to%20generate%20your%20own%20keystore%20file.%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-comment%22%3E%2F%2F%20see%20https%3A%2F%2Ffacebook.github.io%2Freact-native%2Fdocs%2Fsigned-apk-android.%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20signingConfig%20signingConfigs.%3CSPAN%20class%3D%22hljs-function%22%3Edebug%0A%20%20%20%20%20%20%20%20minifyEnabled%20enableProguardInReleaseBuilds%0A%20%20%20%20%20%20%20%20proguardFiles%20%3CSPAN%20class%3D%22hljs-title%22%3EgetDefaultProguardFile%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-params%22%3E(%3CSPAN%20class%3D%22hljs-string%22%3E%22proguard-android.txt%22%3C%2FSPAN%3E)%3C%2FSPAN%3E%2C%20%22proguard-rules.pro%22%0A%20%20%20%20%7D%0A%7D%0A%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThe%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EsigningConfigs%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20includes%20a%20signing%20configuration%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Edebug%3C%2FCODE%3E%2C%20which%20defines%20the%20certificate%20to%20use%2C%20the%20credentials%2C%20etc.%20In%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EbuildTypes%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%2C%20instead%2C%20we%20can%20find%20different%20settings%20that%20are%20applied%20based%20on%20the%20configuration%20we're%20using%20for%20the%20build%3A%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Edebug%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eor%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Erelease%3C%2FCODE%3E.%20You%20can%20notice%20that%2C%20by%20default%2C%20the%20same%20signing%20configuration%20we%20have%20just%20seen%20(the%20one%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EsigningConfigs.debug%3C%2FCODE%3E)%20is%20used%20both%20for%20debug%20and%20release.%20If%20it's%20fine%20to%20keep%20the%20debug%20one%2C%20when%20you%20move%20to%20a%20CI%2FCD%20pipeline%2C%20instead%2C%20you%20will%20need%20to%20remove%20the%20signing%20operation%20for%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Erelease%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Econfiguration.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20reason%20should%20be%20pretty%20clear%3A%20to%20leverage%20this%20approach%20we%20would%20need%20to%20upload%20to%20our%20repository%20the%20private%20key%20and%20to%20include%2C%20in%20clear%2C%20both%20the%20store%20password%20and%20the%20key%20password.%20If%20this%20approach%20is%20fine%20for%20the%20debug%20configuration%20since%20React%20Native%20uses%20a%20generic%20test%20certificate%2C%20it%20isn't%20a%20very%20safe%20approach%20when%20it%20comes%20to%20use%20our%20private%20certificate.%20As%20such%2C%20before%20starting%20to%20build%20our%20pipeline%2C%20let's%20remove%20the%20following%20line%20from%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EbuildTypes.release%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-92%22%20class%3D%22language-java%20hljs%22%3EsigningConfig%20signingConfigs.debug%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThis%20is%20how%20the%20final%20result%20should%20look%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-98%22%20class%3D%22language-java%20hljs%22%3EsigningConfigs%20%7B%0A%20%20%20%20debug%20%7B%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-function%22%3EstoreFile%20%3CSPAN%20class%3D%22hljs-title%22%3Efile%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-params%22%3E(%3CSPAN%20class%3D%22hljs-string%22%3E'debug.keystore'%3C%2FSPAN%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20storePassword%20'android'%0A%20%20%20%20%20%20%20%20keyAlias%20'androiddebugkey'%0A%20%20%20%20%20%20%20%20keyPassword%20'android'%0A%20%20%20%20%7D%0A%7D%0AbuildTypes%20%3C%2FSPAN%3E%7B%0A%20%20%20%20debug%20%7B%0A%20%20%20%20%20%20%20%20signingConfig%20signingConfigs.debug%0A%20%20%20%20%7D%0A%20%20%20%20release%20%7B%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-function%22%3EminifyEnabled%20enableProguardInReleaseBuilds%0A%20%20%20%20%20%20%20%20proguardFiles%20%3CSPAN%20class%3D%22hljs-title%22%3EgetDefaultProguardFile%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-params%22%3E(%3CSPAN%20class%3D%22hljs-string%22%3E%22proguard-android.txt%22%3C%2FSPAN%3E)%3C%2FSPAN%3E%2C%20%22proguard-rules.pro%22%0A%20%20%20%20%7D%0A%7D%0A%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWith%20this%20configuration%2C%20we're%20going%20to%20generate%20a%20release%20APK%20which%20is%20unsigned.%20We're%20going%20to%20sign%20it%20with%20a%20dedicated%20Azure%20DevOps%20task%2C%20which%20will%20allow%20us%20to%20keep%20our%20private%20key%20and%20the%20passwords%20safe.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22setting-up-the-build-number%22%20id%3D%22toc-hId--1862992289%22%20id%3D%22toc-hId--1862992287%22%20id%3D%22toc-hId--1862992287%22%3ESetting%20the%20build%20number%3C%2FH4%3E%0A%3CP%3EExactly%20like%20we%20did%20for%20the%20Windows%20application%2C%20it's%20best%20to%20generate%20a%20new%20APK%20with%20a%20higher%20version%20number%20than%20the%20previous%20version.%20However%2C%20in%20our%20scenario%2C%20things%20are%20slightly%20more%20complicated%20than%20what%20we%20did%20for%20Windows.%20In%20that%20case%2C%20it%20was%20enough%20to%20use%20an%20Azure%20DevOps%20task%20to%20inject%20inside%20the%20manifest%20of%20the%20Windows%20application%20the%20correct%20version%20number.%20In%20our%20scenario%2C%20instead%2C%20it%20won't%20work%2C%20since%20the%20application%20version%20is%20set%20during%20the%20Gradle%20build.%20Even%20if%20we%20would%20add%20a%20task%20in%20the%20CI%20pipeline%20to%20set%20the%20version%20number%20in%20the%20manifest%20of%20the%20Android%20application%2C%20it%20would%20be%20overwritten%20by%20the%20one%20defined%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20during%20the%20build%20process.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20such%2C%20the%20best%20option%20is%20to%20inject%20the%20version%20number%20directly%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile.%20If%20you're%20worried%20that%20this%20means%20that%20you'll%20need%20to%20manually%20manipulate%20the%20Gradle%20file%20with%20a%20PowerShell%20script%20or%20something%20similar%2C%20you%20can%20relax!%20We%20have%20mentioned%20before%20that%20Gradle%20is%20very%20powerful%20and%20that%20the%20build%20files%20can%20contain%20properties.%20These%20properties%20can%20be%20retrieved%20from%20many%20sources%3A%20from%20the%20system%20(like%20an%20environment%20variable)%2C%20from%20another%20file%20or...%20from%20a%20command%20line%20parameter.%20That's%20what%20we%20need!%20Azure%20DevOps%20is%20going%20to%20invoke%20the%20Gradle%20executable%20passing%2C%20as%20parameter%2C%20the%20version%20number.%20Inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Egradle.build%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20we'll%20include%20the%20logic%20to%20read%20the%20value%20from%20the%20parameter%20and%20to%20set%20it%20as%20version%20number%20in%20the%20manifest.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20start%20by%20opening%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20contained%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eandroid%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%20You%20will%20find%20a%20section%20that%20defines%20some%20basic%20information%20which%20are%20stored%20in%20the%20manifest%2C%20like%20the%20minimum%20and%20maximum%20supported%20SDK.%20This%20section%20is%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eext%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20it's%20included%20in%20a%20section%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Ebuildscript%3C%2FCODE%3E%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-127%22%20class%3D%22language-java%20hljs%22%3Eext%20%7B%0A%20%20%20%20buildToolsVersion%20%3D%20%3CSPAN%20class%3D%22hljs-string%22%3E%2228.0.3%22%3C%2FSPAN%3E%0A%20%20%20%20minSdkVersion%20%3D%20%3CSPAN%20class%3D%22hljs-number%22%3E16%3C%2FSPAN%3E%0A%20%20%20%20compileSdkVersion%20%3D%20%3CSPAN%20class%3D%22hljs-number%22%3E28%3C%2FSPAN%3E%0A%20%20%20%20targetSdkVersion%20%3D%20%3CSPAN%20class%3D%22hljs-number%22%3E28%3C%2FSPAN%3E%0A%20%20%20%20supportLibVersion%20%3D%20%3CSPAN%20class%3D%22hljs-string%22%3E%2228.0.0%22%3C%2FSPAN%3E%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWe're%20going%20to%20add%20two%20new%20properties%2C%20to%20store%20the%20version%20name%20and%20the%20version%20code%2C%20which%20are%20the%20two%20values%20used%20by%20Android%20to%20represent%20a%20version%20number.%20Version%20code%20is%20the%20real%20unique%20identifier%20and%20it's%20an%20integer%2C%20which%20must%20be%20incremented%20every%20time%20(for%20example%2C%2056).%20Version%20name%2C%20instead%2C%20is%20a%20string%20and%20represents%20the%20version%20number%20you%20would%20like%20to%20display%20to%20your%20users%20(for%20example%2C%2015.2.3).%20But%20first%2C%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Ebuildscript%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%2C%20let's%20add%20two%20methods%20which%20are%20going%20to%20retrieve%20the%20value%20of%20the%20command%20line%20parameters%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-140%22%20class%3D%22language-java%20hljs%22%3Edef%20getMyVersionCode%20%3D%20%7B%20-%26gt%3B%0A%20%20%20%20def%20code%20%3D%20project.hasProperty(%3CSPAN%20class%3D%22hljs-string%22%3E'versionCode'%3C%2FSPAN%3E)%20%3F%20versionCode.toInteger()%20%3A%20-%3CSPAN%20class%3D%22hljs-number%22%3E1%3C%2FSPAN%3E%0A%20%20%20%20println%20%3CSPAN%20class%3D%22hljs-string%22%3E%22VersionCode%20is%20set%20to%20%24code%22%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ereturn%3C%2FSPAN%3E%20code%0A%7D%0A%0Adef%20getMyVersionName%20%3D%20%7B%20-%26gt%3B%0A%20%20%20%20def%20name%20%3D%20project.hasProperty(%3CSPAN%20class%3D%22hljs-string%22%3E'versionName'%3C%2FSPAN%3E)%20%3F%20versionName%20%3A%20%3CSPAN%20class%3D%22hljs-string%22%3E%221.0%22%3C%2FSPAN%3E%0A%20%20%20%20println%20%3CSPAN%20class%3D%22hljs-string%22%3E%22VersionName%20is%20set%20to%20%24name%22%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ereturn%3C%2FSPAN%3E%20name%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EBoth%20method%20behaves%20in%20the%20same%20way.%20With%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eproperty.hasProperty()%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efunction%20we%20can%20retrieve%20the%20value%20of%20a%20parameter%20passed%20to%20the%20Gradle%20task.%20The%20first%20one%20will%20look%20for%20a%20command%20line%20parameter%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EversionCode%3C%2FSTRONG%3E%2C%20while%20the%20second%20one%20for%20a%20parameter%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EversionName%3C%2FSTRONG%3E.%20If%20they%20aren't%20found%2C%20we're%20going%20to%20set%20a%20default%20value.%20Then%20we%20print%20the%20value%20(it%20will%20be%20helpful%20for%20logging%20purposes)%20and%20we%20return%20it%20to%20the%20caller.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20we%20can%20add%20two%20properties%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eext%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%2C%20which%20value%20will%20be%20retrieved%20using%20these%20two%20functions%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-158%22%20class%3D%22language-java%20hljs%22%3Eext%20%7B%0A%20%20%20%20buildToolsVersion%20%3D%20%3CSPAN%20class%3D%22hljs-string%22%3E%2228.0.3%22%3C%2FSPAN%3E%0A%20%20%20%20minSdkVersion%20%3D%20%3CSPAN%20class%3D%22hljs-number%22%3E16%3C%2FSPAN%3E%0A%20%20%20%20compileSdkVersion%20%3D%20%3CSPAN%20class%3D%22hljs-number%22%3E28%3C%2FSPAN%3E%0A%20%20%20%20targetSdkVersion%20%3D%20%3CSPAN%20class%3D%22hljs-number%22%3E28%3C%2FSPAN%3E%0A%20%20%20%20supportLibVersion%20%3D%20%3CSPAN%20class%3D%22hljs-string%22%3E%2228.0.0%22%3C%2FSPAN%3E%0A%20%20%20%20versionName%20%3D%20getMyVersionName()%0A%20%20%20%20versionCode%20%3D%20getMyVersionCode()%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThis%20is%20how%20your%20entire%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Ebuildscript%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20should%20look%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-172%22%20class%3D%22language-java%20hljs%22%3Ebuildscript%20%7B%0A%0A%20%20%20%20def%20getMyVersionCode%20%3D%20%7B%20-%26gt%3B%0A%20%20%20%20%20%20%20%20def%20code%20%3D%20project.hasProperty(%3CSPAN%20class%3D%22hljs-string%22%3E'versionCode'%3C%2FSPAN%3E)%20%3F%20versionCode.toInteger()%20%3A%20-%3CSPAN%20class%3D%22hljs-number%22%3E1%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20println%20%3CSPAN%20class%3D%22hljs-string%22%3E%22VersionCode%20is%20set%20to%20%24code%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ereturn%3C%2FSPAN%3E%20code%0A%20%20%20%20%7D%0A%0A%20%20%20%20def%20getMyVersionName%20%3D%20%7B%20-%26gt%3B%0A%20%20%20%20%20%20%20%20def%20name%20%3D%20project.hasProperty(%3CSPAN%20class%3D%22hljs-string%22%3E'versionName'%3C%2FSPAN%3E)%20%3F%20versionName%20%3A%20%3CSPAN%20class%3D%22hljs-string%22%3E%221.0%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20println%20%3CSPAN%20class%3D%22hljs-string%22%3E%22VersionName%20is%20set%20to%20%24name%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-keyword%22%3Ereturn%3C%2FSPAN%3E%20name%0A%20%20%20%20%7D%0A%0A%20%20%20%20ext%20%7B%0A%20%20%20%20%20%20%20%20buildToolsVersion%20%3D%20%3CSPAN%20class%3D%22hljs-string%22%3E%2228.0.3%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20minSdkVersion%20%3D%20%3CSPAN%20class%3D%22hljs-number%22%3E16%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20compileSdkVersion%20%3D%20%3CSPAN%20class%3D%22hljs-number%22%3E28%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20targetSdkVersion%20%3D%20%3CSPAN%20class%3D%22hljs-number%22%3E28%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20supportLibVersion%20%3D%20%3CSPAN%20class%3D%22hljs-string%22%3E%2228.0.0%22%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20versionName%20%3D%20getMyVersionName()%0A%20%20%20%20%20%20%20%20versionCode%20%3D%20getMyVersionCode()%0A%20%20%20%20%7D%0A%20%20%20%20repositories%20%7B%0A%20%20%20%20%20%20%20%20google()%0A%20%20%20%20%20%20%20%20jcenter()%0A%20%20%20%20%7D%0A%20%20%20%20dependencies%20%7B%0A%20%20%20%20%20%20%20%20classpath(%3CSPAN%20class%3D%22hljs-string%22%3E%22com.android.tools.build%3Agradle%3A3.4.1%22%3C%2FSPAN%3E)%0A%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-comment%22%3E%2F%2F%20%3CSPAN%20class%3D%22hljs-doctag%22%3ENOTE%3A%3C%2FSPAN%3E%20Do%20not%20place%20your%20application%20dependencies%20here%3B%20they%20belong%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-comment%22%3E%2F%2F%20in%20the%20individual%20module%20build.gradle%20files%3C%2FSPAN%3E%0A%20%20%20%20%7D%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ENow%20we%20need%20to%20open%20the%20other%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%2C%20the%20one%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eandroid%2Fapp%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder%20of%20your%20project.%20You%20will%20find%20a%20section%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EdefaultConfig%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Einside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eandroid%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eblock%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-211%22%20class%3D%22language-java%20hljs%22%3EdefaultConfig%20%7B%0A%20%20%20%20applicationId%20%3CSPAN%20class%3D%22hljs-string%22%3E%22com.navigationsample%22%3C%2FSPAN%3E%0A%20%20%20%20minSdkVersion%20rootProject.ext.minSdkVersion%0A%20%20%20%20targetSdkVersion%20rootProject.ext.targetSdkVersion%0A%20%20%20%20versionCode%20%3CSPAN%20class%3D%22hljs-number%22%3E1%3C%2FSPAN%3E%0A%20%20%20%20versionName%20%3CSPAN%20class%3D%22hljs-string%22%3E%221.0%22%3C%2FSPAN%3E%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWe%20will%20need%20to%20replace%20the%20fixed%20value%20assigned%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EversionCode%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EversionName%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperties%20with%20the%20ones%20coming%20from%20the%20other%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile.%20We%20can%20see%2C%20in%20the%20other%20properties%2C%20an%20example%20of%20how%20to%20achieve%20this%20goal.%20Since%20the%20other%20file%20is%20referenced%20by%20the%20current%20one%2C%20we%20can%20access%20to%20its%20properties%20simply%20by%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3ErootProject.ext.propertyName%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esyntax.%20This%20is%20the%20final%20result%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-224%22%20class%3D%22language-java%20hljs%22%3EdefaultConfig%20%7B%0A%20%20%20%20applicationId%20%3CSPAN%20class%3D%22hljs-string%22%3E%22com.navigationsample%22%3C%2FSPAN%3E%0A%20%20%20%20minSdkVersion%20rootProject.ext.minSdkVersion%0A%20%20%20%20targetSdkVersion%20rootProject.ext.targetSdkVersion%0A%20%20%20%20versionCode%20rootProject.ext.versionCode%0A%20%20%20%20versionName%20rootProject.ext.versionName%0A%7D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThat's%20it.%20Now%20we%20just%20need%20to%20remember%20to%20pass%20to%20the%20Gradle%20executable%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EversionCode%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EversionName%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eparameters%2C%20so%20that%20they%20can%20be%20injected%20in%20the%20default%20configuration.%20We%20will%20do%20it%20in%20a%20moment%2C%20when%20we%20will%20start%20to%20build%20our%20pipeline.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22create-the-ci-pipeline-on-azure-devops%22%20id%3D%22toc-hId--1873495393%22%20id%3D%22toc-hId--1873495391%22%20id%3D%22toc-hId--1873495391%22%3ECreate%20the%20CI%20pipeline%20on%20Azure%20DevOps%3C%2FH3%3E%0A%3CP%3EWe're%20going%20to%20use%20again%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fqmatteoq%2FNavigationSample%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Emy%20sample%20project%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20a%20starting%20point.%20First%2C%20go%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EPipelines%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20and%20create%20a%20new%20pipeline.%20You're%20going%20to%20connect%20it%20to%20the%20same%20repository%20you%20have%20used%20for%20the%20Windows%20application%20but%2C%20this%20time%2C%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAndroid%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20a%20starting%20template%20(you%20will%20need%20to%20click%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EShow%20more%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eat%20the%20bottom%20to%20see%20it).%20The%20default%20YAML%20is%20pretty%20simple%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-239%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-comment%22%3E%23%20Android%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-comment%22%3E%23%20Build%20your%20Android%20project%20with%20Gradle.%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-comment%22%3E%23%20Add%20steps%20that%20test%2C%20sign%2C%20and%20distribute%20the%20APK%2C%20save%20build%20artifacts%2C%20and%20more%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-comment%22%3E%23%20https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fdevops%2Fpipelines%2Flanguages%2Fandroid%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Etrigger%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-bullet%22%3E-%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Emaster%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Epool%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20vmImage%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'macos-latest'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Esteps%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EGradle%402%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20workingDirectory%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E''%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20gradleWrapperFile%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'gradlew'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20gradleOptions%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'-Xmx3072m'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20publishJUnitResults%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-literal%22%3Efalse%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20testResultsFiles%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'**%2FTEST-*.xml'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20tasks%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'assembleDebug'%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EIt%20contains%20just%20a%20Gradle%20task.%20As%20you%20can%20imagine%2C%20we%20will%20need%20to%20do%20a%20few%20tweaks%20to%20make%20it%20good%20enough%20for%20our%20application%20%3D)%3C%2Fimg%3E%20Let's%20start!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22choose-the-hosted-agent%22%20id%3D%22toc-hId--1182933919%22%20id%3D%22toc-hId--1182933917%22%20id%3D%22toc-hId--1182933917%22%3EChoose%20the%20hosted%20agent%3C%2FH4%3E%0A%3CP%3EOut%20of%20the%20box%2C%20the%20template%20uses%20a%20hosted%20agent%20based%20on%20MacOS.%20That's%20perfectly%20fine%20but%2C%20if%20you%20have%20any%20reason%20to%20do%20it%2C%20feel%20free%20to%20switch%20to%20a%20Windows%20or%20a%20Linux%20one.%20Android%20compilation%20is%20supported%20by%20all%20the%20operating%20systems%2C%20so%20you%20can%20use%20the%20one%20you%20prefer.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22set-the-build-number%22%20id%3D%22toc-hId-1304578914%22%20id%3D%22toc-hId-1304578916%22%20id%3D%22toc-hId-1304578916%22%3ESet%20the%20build%20number%3C%2FH4%3E%0A%3CP%3EI%20want%20to%20leverage%20for%20the%20Android%20version%20the%20same%20build%20number%20I'm%20using%20for%20the%20Windows%20version%2C%20which%20we're%20going%20to%20inject%20inside%20the%20manifest%20using%20the%20Gradle%20parameters%20we%20have%20previously%20defined.%20As%20such%2C%20exactly%20like%20I%20did%20for%20the%20Windows%20pipeline%2C%20I'm%20going%20to%20change%20the%20default%20Azure%20DevOps%20build%20number%20by%20setting%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Ename%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-271%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3Ename%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%24(date%3Ayyyy).%24(Month)%24(rev%3A.r)%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThis%20configuration%20will%20generate%20a%20build%20number%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-277%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-number%22%3E2020.1%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-number%22%3E.15%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CH4%20id%3D%22toc-hId--502875549%22%20id%3D%22toc-hId--502875547%22%20id%3D%22toc-hId--502875547%22%3E%26nbsp%3B%3C%2FH4%3E%0A%3CH4%20id%3D%22install-the-dependencies%22%20id%3D%22toc-hId-1984637284%22%20id%3D%22toc-hId-1984637286%22%20id%3D%22toc-hId-1984637286%22%3EInstall%20the%20dependencies%3C%2FH4%3E%0A%3CP%3EAlso%20this%20step%20isn't%20very%20different%20from%20the%20one%20we%20did%20to%20compile%20the%20Windows%20application.%20Before%20compiling%20the%20Android%20version%2C%20we%20need%20to%20make%20sure%20all%20the%20dependencies%20used%20by%20our%20React%20Native%20project%20are%20installed.%20As%20such%2C%20we're%20going%20to%20leverage%20Yarn%20once%20again%20with%20the%20following%20script%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-284%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3E-%20script%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eyarn%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Einstall%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22setup-the-gradle-build%22%20id%3D%22toc-hId-177182821%22%20id%3D%22toc-hId-177182823%22%20id%3D%22toc-hId-177182823%22%3ESetup%20the%20Gradle%20build%3C%2FH4%3E%0A%3CP%3EThe%20Gradle%20task%20will%20take%20care%20of%20running%20the%20build%2C%20by%20using%20the%20configuration%20defined%20in%20the%20various%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efiles.%20However%2C%20compared%20to%20the%20default%20task%20included%20in%20the%20template%2C%20we%20need%20to%20add%20a%20few%20options%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-291%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EGradle%402%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20gradleWrapperFile%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'android%2Fgradlew'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20workingDirectory%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'android%2F'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20options%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'-PversionName%3D%24(Build.BuildNumber)%20-PversionCode%3D%24(Build.BuildId)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20tasks%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'assembleRelease'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20publishJUnitResults%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-literal%22%3Efalse%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20javaHomeOption%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'JDKVersion'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20gradleOptions%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'-Xmx3072m'%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EHere%20are%20the%20changes%20I've%20made%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20id%3D%22pragma-line-305%22%3E%0A%3CLI%20id%3D%22pragma-line-305%22%3E%0A%3CP%3EWe%20need%20to%20specify%20where%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Egradlew%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(the%20wrapper%20which%20launches%20the%20Gradle%20executable)%20is%20located%20through%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EgradleWrapperFile%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty.%20Typically%20it's%20stored%20in%20the%20root%20of%20the%20project.%20However%2C%20in%20our%20scenario%2C%20we're%20working%20with%20a%20React%20Native%20project%2C%20so%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Egradlew%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewrapper%20is%20stored%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eandroid%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder%20and%20not%20in%20the%20root.%20For%20the%20same%20reason%2C%20we%20need%20to%20set%20also%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EworkingDirectory%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eandroid%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-306%22%3E%0A%3CP%3EWe%20need%20to%20pass%2C%20as%20parameters%2C%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EversionName%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EversionCode%3C%2FSTRONG%3E%2C%20so%20that%20they%20can%20be%20injected%20inside%20the%20manifest%20as%20per%20the%20logic%20we%20have%20previously%20added%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile.%20We%20set%20them%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eoptions%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20of%20the%20task%20configuration.%20Command%20line%20parameters%20must%20be%20prefixed%20by%20a%20capital%20P%2C%20so%20we%20set%20them%20as%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E-PversionName%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E-pVersionCode%3C%2FCODE%3E.%20As%20value%2C%20we%20use%20two%20variables%20provided%20by%20Azure%20DevOps%3A%20we're%20using%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%24(Build.BuildNumber)%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20version%20name%20(so%20something%20like%202020.1.15)%2C%20while%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%24(Build.BuildId)%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20version%20code%20(which%20is%20perfect%20for%20our%20scenario%2C%20since%20it's%20an%20incremental%20integer).%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-307%22%3E%0A%3CP%3EThe%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20can%20define%20one%20or%20more%20tasks%2C%20that%20we%20can%20execute%20when%20we%20run%20the%20build.%20In%20case%20of%20a%20React%20Native%20application%2C%20we%20have%20two%20options%3A%3C%2FP%3E%0A%3CUL%20id%3D%22pragma-line-309%22%3E%0A%3CLI%20id%3D%22pragma-line-309%22%3E%3CCODE%3EassembleRelease%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20used%20to%20generate%20an%20APK%2C%20which%20can%20be%20used%20for%20sideloading%20or%20distribution%20through%20App%20Center.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-310%22%3E%3CCODE%3EbundleRelease%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20used%20to%20generate%20an%20AAP%2C%20which%20is%20the%20format%20required%20by%20the%20Google%20Play%20Store.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EIn%20my%20case%20I%20opted%20for%20distribution%20through%20sideloading%20(so%20I%20need%20only%20the%20APK)%2C%20but%20you%20can%20also%20decide%20to%20generate%20both%20packages%20simply%20by%20setting%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Etasks%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-314%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3Etasks%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'assembleRelease%20publishRelease'%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22sign-the-package%22%20id%3D%22toc-hId--399401043%22%20id%3D%22toc-hId--399401041%22%20id%3D%22toc-hId--399401041%22%3ESign%20the%20package%3C%2FH4%3E%0A%3CP%3EAs%20per%20the%20changes%20we%20have%20previously%20made%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%2C%20the%20generated%20APK%20is%20unsigned.%20As%20such%2C%20before%20deploying%20it%2C%20we%20need%20to%20sign%20it%20with%20the%20certificate%20we%20have%20previously%20created.%20We%20can%20do%20it%20using%20a%20dedicated%20task%20available%20in%20Azure%20DevOps%2C%20which%20is%20a%20much%20safer%20approach%20than%20doing%20it%20as%20part%20of%20the%20Gradle%20build%3A%20since%20the%20task%20leverages%20Secure%20Files%20and%20variables%2C%20we%20can%20protect%20our%20private%20key%20and%20our%20credentials.%20As%20first%20step%2C%20we%20need%20to%20upload%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Emy-upload-key.keystore%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20we%20have%20previously%20generated%20as%20a%20Secure%20File%20on%20Azure%20DevOps.%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdevops%2Fpipelines%2Flibrary%2Fsecure-files%3Fview%3Dazure-devops%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3ESecure%20Files%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20a%20feature%20which%20allows%20to%20upload%20files%20that%20can%20be%20only%20used%20in%20a%20specific%20pipeline%20or%2C%20eventually%2C%20deleted.%20No%20one%2C%20even%20the%20administrator%20of%20the%20Azure%20DevOps%20account%2C%20will%20be%20able%20to%20download%20it.%20It's%20a%20perfect%20fit%20for%20our%20private%20certificate%3A%20even%20if%20we're%20going%20to%20share%20the%20project%20with%20other%20developers%2C%20they%20won't%20be%20able%20to%20download%20the%20certificate%20and%20perform%20potentially%20malicious%20tasks%20(like%20using%20your%20certificate%20to%20sign%20other%20applications).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETo%20upload%20the%20file%2C%20move%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ELibrary%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20under%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EPipelines%3C%2FSTRONG%3E.%20Select%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESecure%20Files%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etab%20and%20press%20the%20%2B%20button%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20850px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F164062i220DEF837173F016%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22library.png%22%20title%3D%22library.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EDrag%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Emy-upload-key.keystore%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bfile%20you%20have%20previously%20generated%20and%20upload%20it.%20That's%20it.%20Now%20we'll%20be%20able%20to%20reference%20this%20file%20in%20the%20signing%20task.%20We%20need%20to%20safely%20save%20also%20the%20store%20password%2C%20the%20key%20alias%20and%20the%20key%20password.%20We're%20going%20to%20create%20a%20variable%20for%20each%20of%20them%2C%20so%20that%20we%20don't%20have%20to%20add%20them%20in%20clear%20in%20the%20task.%20In%20the%20pipeline%20editor%20in%20Azure%20DevOps%20click%20on%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EVariables%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Band%20press%20%2B%20to%20add%20a%20new%20one.%20Name%20it%20as%20you%20prefer.%20For%20example%2C%20let's%20start%20with%20the%20store%20password%2C%20so%20call%20it%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EKeyStorePassword%3C%2FSTRONG%3E%3CSPAN%3E.%20As%20value%2C%20type%20the%20password%20you%20have%20specified%20during%20the%20key%20creation%2C%20then%20enable%20the%20option%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EKeep%20this%20value%20secret%3C%2FSTRONG%3E%3CSPAN%3E.%20This%20will%20make%20sure%20that%20no%20one%20will%20be%20able%20to%20read%20its%20value.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20463px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F164063iE2137165D59E9161%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22StorePassword.png%22%20title%3D%22StorePassword.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ENow%20repeat%20the%20process%20for%20the%20other%20two%20variables.%20At%20the%20end%2C%20you%20should%20see%20a%20list%20like%20this%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20467px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F164064i94D6E0AFEF83EE9C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Variables.png%22%20title%3D%22Variables.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20we%20are%20ready%20to%20add%20the%20task%20to%20our%20pipeline%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-338%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EAndroidSigning%403%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20apkFiles%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'**%2F*.apk'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20apksignerKeystoreFile%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'my-upload-key.keystore'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20apksignerKeystorePassword%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(KeyStorePassword)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20apksignerKeystoreAlias%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(KeyAlias)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20apksignerKeyPassword%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(KeyPassword)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20zipalign%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-literal%22%3Efalse%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3COL%20id%3D%22pragma-line-349%22%3E%0A%3CLI%20id%3D%22pragma-line-349%22%3EUsing%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EapkFiles%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%2C%20we%20specify%20we%20want%20to%20sign%20all%20the%20APK%20files%20included%20in%20the%20output%20folder.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-350%22%3EAs%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EapksignerKeystoreFile%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewe%20need%20to%20add%20a%20reference%20to%20the%20private%20key%20we%20have%20previously%20uploaded%20as%20secure%20file.%20We%20need%20just%20to%20specify%20it's%20base%20name%2C%20like%20if%20it's%20a%20local%20file.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-351%22%3EAs%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EapksignerKeyStorePassword%3C%2FCODE%3E%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EapksignerKeystoreAlias%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EapksignerKeyPassword%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewe%20need%20to%20specify%20the%20three%20variables%20we%20have%20previously%20created.%20We%20use%20the%20standard%20syntax%20supported%20by%20Azure%20DevOps%2C%20which%20is%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%24(variableName)%3C%2FCODE%3E.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH4%20id%3D%22publish-the-build-artifacts%22%20id%3D%22toc-hId-2088111790%22%20id%3D%22toc-hId-2088111792%22%20id%3D%22toc-hId-2088111792%22%3EPublish%20the%20build%20artifacts%3C%2FH4%3E%0A%3CP%3EWe're%20almost%20done.%20We%20just%20need%20to%20publish%20the%20signed%20APK%20package%20as%20build%20artifact%2C%20so%20that%20our%20CI%20pipeline%20will%20be%20able%20to%20pick%20it%20for%20deployment.%20This%20is%20the%20task%20to%20add%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-356%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EPublishBuildArtifacts%401%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20PathtoPublish%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'android%2Fapp%2Fbuild%2Foutputs%2Fapk%2Frelease'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20ArtifactName%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'drop'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20publishLocation%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Container'%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWhen%20you%20generate%20an%20APK%20for%20a%20React%20Native%20application%2C%20the%20file%20is%20created%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eandroid%2Fapp%2Fbuild%2Foutputs%2Fapk%2Frelease%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%20As%20such%2C%20we%20copy%20only%20the%20content%20of%20this%20folder.%20In%20case%20you%20have%20generated%20also%20an%20AAP%20for%20the%20Google%20Play%20Store%2C%20the%20file%20will%20be%20inside%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eandroid%2Fapp%2Fbuild%2Foutputs%2Fbundle%2Frelease%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22executing-the-pipeline%22%20id%3D%22toc-hId-151574608%22%20id%3D%22toc-hId-151574610%22%20id%3D%22toc-hId-151574610%22%3EExecuting%20the%20pipeline%3C%2FH3%3E%0A%3CP%3EAfter%20all%20the%20changes%20you%20have%20done%2C%20this%20is%20how%20the%20final%20pipeline%20should%20look%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-369%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3Etrigger%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-bullet%22%3E-%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Emaster%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Epool%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20vmImage%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'ubuntu-latest'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Ename%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%24(date%3Ayyyy).%24(Month)%24(rev%3A.r)%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Esteps%3A%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20script%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eyarn%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Einstall%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EGradle%402%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20gradleWrapperFile%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'android%2Fgradlew'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20workingDirectory%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'android%2F'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20options%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'-PversionName%3D%24(Build.BuildNumber)%20-PversionCode%3D%24(Build.BuildId)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20tasks%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'assembleRelease'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20publishJUnitResults%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-literal%22%3Efalse%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20javaHomeOption%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'JDKVersion'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20gradleOptions%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'-Xmx3072m'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EAndroidSigning%403%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20apkFiles%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'**%2F*.apk'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20apksignerKeystoreFile%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'my-upload-key.keystore'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20apksignerKeystorePassword%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(KeyStorePassword)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20apksignerKeystoreAlias%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(KeyAlias)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20apksignerKeyPassword%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(KeyPassword)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20zipalign%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-literal%22%3Efalse%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EPublishBuildArtifacts%401%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20PathtoPublish%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'android%2Fapp%2Fbuild%2Foutputs%2Fapk%2Frelease'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20ArtifactName%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'drop'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20publishLocation%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Container'%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EAfter%20saving%20it%2C%20Azure%20DevOps%20will%20automatically%20trigger%20it.%20Checking%20the%20logs%20will%20be%20helpful%20to%20understand%20if%20everything%20is%20running%20fine.%20For%20example%2C%20the%20version%20code%20and%20version%20number%20we%20have%20passed%20as%20parameters%20should%20be%20displayed%20as%20part%20of%20the%20Gradle%20task%2C%20since%20we%20have%20printed%20them%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F164065iF61C9DA527076E71%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22GradleLogging.png%22%20title%3D%22GradleLogging.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAt%20the%20end%20of%20the%20process%2C%20your%20artifact%20will%20contain%20the%20generated%20APK%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20769px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F164066iA38D092BB001EC16%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22GenericAPK.png%22%20title%3D%22GenericAPK.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22improving-the-generated-name%22%20id%3D%22toc-hId--1526797136%22%20id%3D%22toc-hId--1526797134%22%20id%3D%22toc-hId--1526797134%22%3EImproving%20the%20generated%20file%20name%3C%2FH4%3E%0A%3CP%3EBy%20default%2C%20the%20generated%20APK%20will%20be%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eapp-release-unsigned.apk%3C%2FSTRONG%3E.%20There%20isn't%20any%20specific%20downside%20in%20using%20this%20name%2C%20but%20it%20may%20be%20hard%20to%20track%20which%20exact%20app%20and%20version%20is%20included%20inside%20the%20package.%20It%20would%20be%20better%20to%20give%20it%20a%20more%20meaningful%20name%2C%20maybe%20including%20also%20the%20version%20number.%20We%20can%20do%20it%20by%20modifying%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20included%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eandroid%2Fapp%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%20Towards%20the%20end%20of%20the%20file%20you%20will%20find%20a%20section%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EapplicationVariants.all%3C%2FCODE%3E%2C%20which%20iterates%20all%20the%20files%20which%20are%20generated%20by%20the%20build%20process%20to%20configure%20them.%20This%20is%20how%20it%20looks%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-419%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-string%22%3EapplicationVariants.all%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%7B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Evariant%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-bullet%22%3E-%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Evariant.outputs.each%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%7B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eoutput%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-bullet%22%3E-%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%2F%2F%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EFor%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eeach%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eseparate%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EAPK%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eper%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Earchitecture%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eset%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Ea%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eunique%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eversion%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Ecode%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eas%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Edescribed%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3Ehere%3A%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%2F%2F%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3Ehttps%3A%2F%2Fdeveloper.android.com%2Fstudio%2Fbuild%2Fconfigure-apk-splits.html%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Edef%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EversionCodes%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%5B%22armeabi-v7a%22%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%22x86%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%22arm64-v8a%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E3%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%22x86_64%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E4%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%5D%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Edef%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eabi%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eoutput.getFilter(OutputFile.ABI)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E(abi%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E!%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-literal%22%3Enull%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%7B%3C%2FSPAN%3E%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%2F%2F%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-literal%22%3Enull%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Efor%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Ethe%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Euniversal-debug%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Euniversal-release%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Evariants%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Eoutput.versionCodeOverride%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%3D%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3EversionCodes.get(abi)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E*%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E1048576%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%2B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EdefaultConfig.versionCode%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%7D%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%7D%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-string%22%3E%7D%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThe%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eoutput%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eobject%20represents%20a%20single%20file%20that%20is%20produced%20by%20the%20build%2C%20so%20we%20can%20use%20it%20to%20change%20the%20file%20name%20thanks%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EoutputFileName%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty.%20This%20is%20how%20the%20section%20should%20look%20like%20after%20our%20change%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-436%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-string%22%3EapplicationVariants.all%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%7B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Evariant%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-bullet%22%3E-%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Evariant.outputs.each%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%7B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eoutput%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-bullet%22%3E-%26gt%3B%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%2F%2F%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EFor%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eeach%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eseparate%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EAPK%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eper%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Earchitecture%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eset%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Ea%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eunique%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eversion%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Ecode%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eas%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Edescribed%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3Ehere%3A%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%2F%2F%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3Ehttps%3A%2F%2Fdeveloper.android.com%2Fstudio%2Fbuild%2Fconfigure-apk-splits.html%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Edef%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EversionCodes%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%5B%22armeabi-v7a%22%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%22x86%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E2%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%22arm64-v8a%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E3%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%22x86_64%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E4%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E%5D%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Edef%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eabi%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eoutput.getFilter(OutputFile.ABI)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Eif%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E(abi%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E!%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-literal%22%3Enull%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%7B%3C%2FSPAN%3E%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%2F%2F%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-literal%22%3Enull%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Efor%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Ethe%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Euniversal-debug%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Euniversal-release%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Evariants%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Eoutput.versionCodeOverride%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%3D%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3EversionCodes.get(abi)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E*%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E1048576%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%2B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EdefaultConfig.versionCode%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%7D%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3Eoutput.outputFileName%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Eoutput.outputFileName%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E.replace(%22app-%22%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%22NavigationSample-%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E.replace(%22unsigned%22%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%22%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E)%3C%2FSPAN%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E.replace(%22.apk%22%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%22%24%7Bvariant.versionName%7D.apk%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3E)%3C%2FSPAN%3E%0A%0A%20%20%20%20%3CSPAN%20class%3D%22hljs-string%22%3E%7D%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-string%22%3E%7D%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWe're%20taking%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EoutputFileName%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20and%3A%3C%2FP%3E%0A%3CUL%20id%3D%22pragma-line-458%22%3E%0A%3CLI%20id%3D%22pragma-line-458%22%3EWe%20replace%20the%20generic%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eapp-%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Estring%20with%20the%20name%20of%20our%20application%20(in%20my%20case%2C%20it's%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3ENavigationSample-%3C%2FCODE%3E).%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-459%22%3EWe%20remove%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3Eunsigned%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Estring%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-460%22%3EWe%20add%2C%20as%20suffix%2C%20the%20version%20number%2C%20which%20can%20be%20referenced%20with%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%24%7Bvariant.versionName%7D%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ENow%2C%20if%20we%20save%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild.gradle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efile%20and%20we%20push%20it%20to%20our%20repository%2C%20Azure%20DevOps%20will%20trigger%20a%20new%20execution%20of%20the%20pipeline.%20At%20the%20end%20of%20the%20process%2C%20we%20will%20find%20in%20the%20artifacts%20an%20APK%20with%20a%20more%20meaningful%20name%2C%20like%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ENavigationSample-2020.1.18.apk%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20751px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F164067i4FDD52ABB800C21E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22RealNameAPK.png%22%20title%3D%22RealNameAPK.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22deploy-the-application%22%20id%3D%22toc-hId-831632978%22%20id%3D%22toc-hId-831632980%22%20id%3D%22toc-hId-831632980%22%3EDeploy%20the%20application%3C%2FH3%3E%0A%3CP%3ENow%20that%20you%20have%20generated%20a%20signed%20package%2C%20you%20can%20create%20a%20release%20pipeline%20to%20do%20the%20deployment.%20You%20have%20many%20options%2C%20based%20on%20your%20scenario.%20If%20you%20have%20generated%20an%20AAP%20and%20you%20want%20to%20publish%20it%20on%20the%20Google%20Play%20Store%2C%20Azure%20DevOps%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dms-vsclient.google-play%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eoffers%20a%20task%20for%20that%3C%2FA%3E.%20Another%20great%20option%20is%20to%20deploy%20your%20application%20to%20a%20group%20of%20testers%2C%20that%20will%20help%20you%20to%20validate%20the%20update%20before%20publishing%20it%20on%20the%20Store.%20In%20this%20case%20you%20can%20leverage%20App%20Center%2C%20the%20Microsoft%20platform%20to%20automate%20the%20build%2C%20deployment%20and%20testing%20of%20mobile%20and%20desktop%20apps.%20Also%20for%20this%20scenario%20Azure%20DevOps%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdevops%2Fpipelines%2Ftasks%2Fdeploy%2Fapp-center-distribute%3Fview%3Dazure-devops%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eoffers%20a%20dedicated%20task%3C%2FA%3E%2C%20you'll%20just%20need%20a%20free%20account%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fappcenter.ms%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EApp%20Center%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22wrapping-up%22%20id%3D%22toc-hId--975821485%22%20id%3D%22toc-hId--975821483%22%20id%3D%22toc-hId--975821483%22%3EWrapping%20up%3C%2FH3%3E%0A%3CP%3EIn%20this%20post%20we%20have%20learned%20how%20to%20create%20a%20CI%20pipeline%20for%20our%20React%20Native%20project%20to%20generate%20an%20Android%20application.%20We%20have%20created%20it%20alongside%20the%20Windows%20one%20we%20have%20already%20created%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fwindows-dev-appconsult%2Fcreate-a-ci-cd-pipeline-for-a-react-native-for-windows%2Fba-p%2F1083253%22%20target%3D%22_blank%22%3Ein%20another%20post%3C%2FA%3E.%20Now%2C%20every%20time%20we're%20going%20to%20commit%20some%20new%20code%20to%20our%20repository%2C%20Azure%20DevOps%20will%20automatically%20build%20and%20deploy%20both%20the%20Windows%20and%20Android%20versions%20of%20our%20application.%20Once%20they%20have%20been%20validated%2C%20we%20can%20automatically%20deploy%20them%20to%20our%20users%2C%20regardless%20if%20we're%20using%20sideloading%20or%20the%20Store.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you're%20building%20React%20Native%20applications%20for%20Android%20and%20iOS%2C%20there's%20also%20another%20option%20you%20can%20explore%3A%20App%20Center.%20Other%20than%20using%20it%20to%20perform%20the%20deployment%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fappcenter%2Fbuild%2Freact-native%2Fandroid%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EApp%20Center%20supports%20also%20directly%20enabling%20CI%2FCD%3C%2FA%3E.%20You%20just%20need%20to%20connect%20it%20to%20your%20repository%2C%20specify%20that%20your%20project%20is%20based%20on%20React%20Native%20and%20setup%20a%20few%20parameters%20(like%20providing%20the%20private%20certificate%20and%20the%20passwords).%20App%20Center%20will%20take%20care%20of%20everything%20and%20it%20will%20automatically%20create%20a%20pipeline%20for%20you.%20In%20my%20case%2C%20I%20preferred%20to%20use%20Azure%20DevOps%20because%20I%20wanted%20more%20flexibility%20and%20to%20consolidate%20all%20the%20pipelines%20for%20my%20project%20(Windows%2C%20Android%20and%20in%20the%20future%20iOS)%20in%20a%20single%20place.%20However%2C%20App%20Center%20is%20a%20great%20choice%20if%20you're%20looking%20for%20a%20simple%20and%20reliable%20solution%20to%20automatically%20build%20and%20deploy%20your%20React%20Native%20projects.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHappy%20coding!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1094422%22%20slang%3D%22en-US%22%3E%3CP%3EIn%20this%20post%20you%20will%20learn%20how%20to%20create%20a%20CI%2FCD%20pipeline%20to%20automate%20the%20build%20and%20deployment%20of%20an%20Android%20application%20built%20with%20React%20Native%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1096043%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20Azure%20DevOps%20to%20create%20a%20CI%2FCD%20pipeline%20for%20an%20Android%20application%20built%20with%20React%20Native%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1096043%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20Sharing%20this%20great%20blogpost%20with%20the%20Community%26nbsp%3B%3CIMG%20class%3D%22lia-deferred-image%20lia-image-emoji%22%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Fhtml%2Fimages%2Femoticons%2Fcool_40x40.gif%22%20alt%3D%22%3Acool%3A%22%20title%3D%22%3Acool%3A%22%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

In the previous posts I have written on this blog I have talked about many specific tasks related to React Native for Windows: how to build a native module, how to setup a CI/CD pipeline on Azure DevOps, etc. However, one of the advantages of React Native is the ability to target multiple platforms leveraging the same codebase and, at the same time, achieve the same quality of a native application. This is made possible by the different render targets, which translates the various JSX controls into native controls of the platform where the application is running. And thanks to native modules, we can also build plugins which, under the hood, use Android, iOS or Windows APIs to perform a task.

 

As such, after having successfully built a CI/CD pipeline on Azure DevOps for automatically build and deploy my React Native project for Windows, I decided to move to the next step and build such a pipeline also for the other platforms. The goal is to have a Windows, Android and iOS application automatically deployed every time I commit some code to the repository which hosts my React Native project.

 

Let's start to see how we can add Android support to our pipeline!

 

Welcome Gradle

If you have ever tried to deploy your React Native application on Android, you should already have met Gradle. It's a very popular build automation system, widely used for Java projects. You can think of it like MSBuild, but for platforms different than C# and .NET. Exactly like MSBuild, Gradle allows to setup, trough properties and configuration files, complex build systems, which require additional tasks other than just compiling the source code. This is the reason why React Native uses Gradle for the Android platform: it's able to perform all the tasks which are required to bundle and package together the JavaScript files, other than just compiling the Java code into an APK package. When you run your React Native project for Android using the following command:

 

react-native run-android

the React Native CLI will run Gradle to build the APK and then it will launch the Metro packager, so that you can have a live development and debugging experience. If you use the React Native CLI, instead, to generate a release package, Gradle will generate a bundle first and then it will create a standalone APK package. It isn't a very different experience from what we did in the previous posts for the Windows project. In that case, it was MSBuild to take care of everything for us and to generate a MSIX package with all the required files.

 

The Android build process is controlled by a file called build.gradle, which defines all the tasks that must be performed during the compilation. Gradle support a scripting language, so you can define variables, read properties, add conditions and logic, etc.

 

In case of a React Native project, Gradle leverages two different build.gradle files:

  • A build.gradle file inside the android folder, which is the top-level build file where you can add configuration options common to all sub-projects/modules.
  • A build.gradle file inside the android/app folder, which instead contains the various tasks and properties which are used to generate the APK.

Understanding the basics of Gradle is very important, since we'll need to make a few changes to the default build.gradle in order to make the project suitable for a CI/CD pipeline. Let' see them!

 

Create a signing certificate

Exactly like we did in our Windows application, also Android applications must be signed with a valid certificate in order to be installed. As such, the first step is to create a private key that will be used for this task. We can do it using a tool which comes with the Java SDK called keytool. If you have the JDK installed on your machine, you will find it in the C:\Program Files\Java\jdkx.x.x_x\bin folder, where x.x.x._x is the JDK version. If you have Visual Studio with the Xamarin tools installed, you can also open Visual Studio and choose Tools → Android → Android Adb Command Prompt. This option will open a command prompt with the JDK path included in the global paths, so you will be able to invoke the keytool command from any location.

 

Regardless of the option you choose, this is the command you'll need to type:

 

keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

Two parameters can be customized here:

  • keystore defines the name of the file that will be generated. The previous command will generate a file called my-upload-key.keystore
  • alias defines the alias that will be assigned to the key. The previous command will generate an alias called my-key-alias. Feel free to replace it with the one you prefer, as long as you note it somewhere because you will need it to perform the signing.

After pressing Enter, you will be asked for the following information:

  • The password to use to protect the certificate store
  • First and last name
  • Organizational Unit
  • Organization
  • City or locality
  • State or province
  • Country code

These information will be used to generate the subject of the certificate. For example, in my case the generated subject was:

 

CN=Matteo Pagani, OU=AppConsult, O=Microsoft, L=Como, ST=CO, C=IT

Once you have confirmed, you will be asked for the password to protect the key, which can be a different one or the same you have previously used to protect the certificate store. At the end of the process, the tool will create a file in the same folder called my-upload-key.keystore with the private key. Make sure to store it in a safe place. We're going to need it later to sign the APK as part of our pipeline.

 

Setup the signing

By default, React Native signs the generated APK as part of the build process. We can see this task in the second build.gradle file, the one inside the android/app folder. Open it with a text editor of your choice and look for a section called android. You will find the following entry:

 

signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://facebook.github.io/react-native/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}

The signingConfigs section includes a signing configuration called debug, which defines the certificate to use, the credentials, etc. In the buildTypes section, instead, we can find different settings that are applied based on the configuration we're using for the build: debug or release. You can notice that, by default, the same signing configuration we have just seen (the one called signingConfigs.debug) is used both for debug and release. If it's fine to keep the debug one, when you move to a CI/CD pipeline, instead, you will need to remove the signing operation for the release configuration.

 

The reason should be pretty clear: to leverage this approach we would need to upload to our repository the private key and to include, in clear, both the store password and the key password. If this approach is fine for the debug configuration since React Native uses a generic test certificate, it isn't a very safe approach when it comes to use our private certificate. As such, before starting to build our pipeline, let's remove the following line from the buildTypes.release section:

 

signingConfig signingConfigs.debug

This is how the final result should look like:

 

signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}

With this configuration, we're going to generate a release APK which is unsigned. We're going to sign it with a dedicated Azure DevOps task, which will allow us to keep our private key and the passwords safe.

 

Setting the build number

Exactly like we did for the Windows application, it's best to generate a new APK with a higher version number than the previous version. However, in our scenario, things are slightly more complicated than what we did for Windows. In that case, it was enough to use an Azure DevOps task to inject inside the manifest of the Windows application the correct version number. In our scenario, instead, it won't work, since the application version is set during the Gradle build. Even if we would add a task in the CI pipeline to set the version number in the manifest of the Android application, it would be overwritten by the one defined in the build.gradle file during the build process.

 

As such, the best option is to inject the version number directly in the build.gradle file. If you're worried that this means that you'll need to manually manipulate the Gradle file with a PowerShell script or something similar, you can relax! We have mentioned before that Gradle is very powerful and that the build files can contain properties. These properties can be retrieved from many sources: from the system (like an environment variable), from another file or... from a command line parameter. That's what we need! Azure DevOps is going to invoke the Gradle executable passing, as parameter, the version number. Inside the gradle.build file we'll include the logic to read the value from the parameter and to set it as version number in the manifest.

 

Let's start by opening the build.gradle file contained in the android folder. You will find a section that defines some basic information which are stored in the manifest, like the minimum and maximum supported SDK. This section is called ext and it's included in a section called buildscript:

 

ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 28
    supportLibVersion = "28.0.0"
}

We're going to add two new properties, to store the version name and the version code, which are the two values used by Android to represent a version number. Version code is the real unique identifier and it's an integer, which must be incremented every time (for example, 56). Version name, instead, is a string and represents the version number you would like to display to your users (for example, 15.2.3). But first, inside the buildscript section, let's add two methods which are going to retrieve the value of the command line parameters:

 

def getMyVersionCode = { ->
    def code = project.hasProperty('versionCode') ? versionCode.toInteger() : -1
    println "VersionCode is set to $code"
    return code
}

def getMyVersionName = { ->
    def name = project.hasProperty('versionName') ? versionName : "1.0"
    println "VersionName is set to $name"
    return name
}

Both method behaves in the same way. With the property.hasProperty() function we can retrieve the value of a parameter passed to the Gradle task. The first one will look for a command line parameter called versionCode, while the second one for a parameter called versionName. If they aren't found, we're going to set a default value. Then we print the value (it will be helpful for logging purposes) and we return it to the caller.

 

Now we can add two properties in the ext section, which value will be retrieved using these two functions:

 

ext {
    buildToolsVersion = "28.0.3"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 28
    supportLibVersion = "28.0.0"
    versionName = getMyVersionName()
    versionCode = getMyVersionCode()
}

This is how your entire buildscript section should look like:

 

buildscript {

    def getMyVersionCode = { ->
        def code = project.hasProperty('versionCode') ? versionCode.toInteger() : -1
        println "VersionCode is set to $code"
        return code
    }

    def getMyVersionName = { ->
        def name = project.hasProperty('versionName') ? versionName : "1.0"
        println "VersionName is set to $name"
        return name
    }

    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        versionName = getMyVersionName()
        versionCode = getMyVersionCode()
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.4.1")

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

Now we need to open the other build.gradle file, the one inside the android/app folder of your project. You will find a section called defaultConfig inside the android block:

 

defaultConfig {
    applicationId "com.navigationsample"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
}

We will need to replace the fixed value assigned to the versionCode and versionName properties with the ones coming from the other build.gradle file. We can see, in the other properties, an example of how to achieve this goal. Since the other file is referenced by the current one, we can access to its properties simply by using the rootProject.ext.propertyName syntax. This is the final result:

 

defaultConfig {
    applicationId "com.navigationsample"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode rootProject.ext.versionCode
    versionName rootProject.ext.versionName
}

That's it. Now we just need to remember to pass to the Gradle executable the versionCode and the versionName parameters, so that they can be injected in the default configuration. We will do it in a moment, when we will start to build our pipeline.

 

Create the CI pipeline on Azure DevOps

We're going to use again my sample project as a starting point. First, go to the Pipelines section and create a new pipeline. You're going to connect it to the same repository you have used for the Windows application but, this time, choose Android as a starting template (you will need to click on Show more at the bottom to see it). The default YAML is pretty simple:

 

# Android
# Build your Android project with Gradle.
# Add steps that test, sign, and distribute the APK, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/android

trigger:
- master

pool:
  vmImage: 'macos-latest'

steps:
- task: Gradle@2
  inputs:
    workingDirectory: ''
    gradleWrapperFile: 'gradlew'
    gradleOptions: '-Xmx3072m'
    publishJUnitResults: false
    testResultsFiles: '**/TEST-*.xml'
    tasks: 'assembleDebug'

It contains just a Gradle task. As you can imagine, we will need to do a few tweaks to make it good enough for our application =) Let's start!

 

Choose the hosted agent

Out of the box, the template uses a hosted agent based on MacOS. That's perfectly fine but, if you have any reason to do it, feel free to switch to a Windows or a Linux one. Android compilation is supported by all the operating systems, so you can use the one you prefer.

 

Set the build number

I want to leverage for the Android version the same build number I'm using for the Windows version, which we're going to inject inside the manifest using the Gradle parameters we have previously defined. As such, exactly like I did for the Windows pipeline, I'm going to change the default Azure DevOps build number by setting the name property:

 

name: $(date:yyyy).$(Month)$(rev:.r)

This configuration will generate a build number like:

 

2020.1.15

 

Install the dependencies

Also this step isn't very different from the one we did to compile the Windows application. Before compiling the Android version, we need to make sure all the dependencies used by our React Native project are installed. As such, we're going to leverage Yarn once again with the following script:

 

- script: yarn install

 

Setup the Gradle build

The Gradle task will take care of running the build, by using the configuration defined in the various build.gradle files. However, compared to the default task included in the template, we need to add a few options:

 

- task: Gradle@2
  inputs:
    gradleWrapperFile: 'android/gradlew'
    workingDirectory: 'android/'
    options: '-PversionName=$(Build.BuildNumber) -PversionCode=$(Build.BuildId)'
    tasks: 'assembleRelease'
    publishJUnitResults: false
    javaHomeOption: 'JDKVersion'
    gradleOptions: '-Xmx3072m'

Here are the changes I've made:

 

  1. We need to specify where gradlew (the wrapper which launches the Gradle executable) is located through the gradleWrapperFile property. Typically it's stored in the root of the project. However, in our scenario, we're working with a React Native project, so the gradlew wrapper is stored inside the android folder and not in the root. For the same reason, we need to set also the workingDirectory property to android.

  2. We need to pass, as parameters, the versionName and the versionCode, so that they can be injected inside the manifest as per the logic we have previously added in the build.gradle file. We set them in the options section of the task configuration. Command line parameters must be prefixed by a capital P, so we set them as -PversionName and -pVersionCode. As value, we use two variables provided by Azure DevOps: we're using $(Build.BuildNumber) as version name (so something like 2020.1.15), while $(Build.BuildId) as version code (which is perfect for our scenario, since it's an incremental integer).

  3. The build.gradle file can define one or more tasks, that we can execute when we run the build. In case of a React Native application, we have two options:

    • assembleRelease is used to generate an APK, which can be used for sideloading or distribution through App Center.
    • bundleRelease is used to generate an AAP, which is the format required by the Google Play Store.

    In my case I opted for distribution through sideloading (so I need only the APK), but you can also decide to generate both packages simply by setting the tasks property like this:

     

    tasks: 'assembleRelease publishRelease'

 

Sign the package

As per the changes we have previously made in the build.gradle file, the generated APK is unsigned. As such, before deploying it, we need to sign it with the certificate we have previously created. We can do it using a dedicated task available in Azure DevOps, which is a much safer approach than doing it as part of the Gradle build: since the task leverages Secure Files and variables, we can protect our private key and our credentials. As first step, we need to upload the my-upload-key.keystore file we have previously generated as a Secure File on Azure DevOps. Secure Files is a feature which allows to upload files that can be only used in a specific pipeline or, eventually, deleted. No one, even the administrator of the Azure DevOps account, will be able to download it. It's a perfect fit for our private certificate: even if we're going to share the project with other developers, they won't be able to download the certificate and perform potentially malicious tasks (like using your certificate to sign other applications).

 

To upload the file, move to the Library section under Pipelines. Select the Secure Files tab and press the + button:

 

library.png

 

Drag the my-upload-key.keystore file you have previously generated and upload it. That's it. Now we'll be able to reference this file in the signing task. We need to safely save also the store password, the key alias and the key password. We're going to create a variable for each of them, so that we don't have to add them in clear in the task. In the pipeline editor in Azure DevOps click on Variables and press + to add a new one. Name it as you prefer. For example, let's start with the store password, so call it KeyStorePassword. As value, type the password you have specified during the key creation, then enable the option Keep this value secret. This will make sure that no one will be able to read its value.

 

StorePassword.png

 

Now repeat the process for the other two variables. At the end, you should see a list like this:

 

Variables.png

 

Now we are ready to add the task to our pipeline:

 

- task: AndroidSigning@3
  inputs:
    apkFiles: '**/*.apk'
    apksignerKeystoreFile: 'my-upload-key.keystore'
    apksignerKeystorePassword: '$(KeyStorePassword)'
    apksignerKeystoreAlias: '$(KeyAlias)'
    apksignerKeyPassword: '$(KeyPassword)'
    zipalign: false
  1. Using the apkFiles property, we specify we want to sign all the APK files included in the output folder.
  2. As apksignerKeystoreFile we need to add a reference to the private key we have previously uploaded as secure file. We need just to specify it's base name, like if it's a local file.
  3. As apksignerKeyStorePassword, apksignerKeystoreAlias and apksignerKeyPassword we need to specify the three variables we have previously created. We use the standard syntax supported by Azure DevOps, which is $(variableName).

Publish the build artifacts

We're almost done. We just need to publish the signed APK package as build artifact, so that our CI pipeline will be able to pick it for deployment. This is the task to add:

 

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'android/app/build/outputs/apk/release'
    ArtifactName: 'drop'
    publishLocation: 'Container'

When you generate an APK for a React Native application, the file is created inside the android/app/build/outputs/apk/release folder. As such, we copy only the content of this folder. In case you have generated also an AAP for the Google Play Store, the file will be inside the android/app/build/outputs/bundle/release folder.

 

Executing the pipeline

After all the changes you have done, this is how the final pipeline should look like:

 

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

name: $(date:yyyy).$(Month)$(rev:.r)

steps:

- script: yarn install

- task: Gradle@2
  inputs:
    gradleWrapperFile: 'android/gradlew'
    workingDirectory: 'android/'
    options: '-PversionName=$(Build.BuildNumber) -PversionCode=$(Build.BuildId)'
    tasks: 'assembleRelease'
    publishJUnitResults: false
    javaHomeOption: 'JDKVersion'
    gradleOptions: '-Xmx3072m'

- task: AndroidSigning@3
  inputs:
    apkFiles: '**/*.apk'
    apksignerKeystoreFile: 'my-upload-key.keystore'
    apksignerKeystorePassword: '$(KeyStorePassword)'
    apksignerKeystoreAlias: '$(KeyAlias)'
    apksignerKeyPassword: '$(KeyPassword)'
    zipalign: false

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'android/app/build/outputs/apk/release'
    ArtifactName: 'drop'
    publishLocation: 'Container'

After saving it, Azure DevOps will automatically trigger it. Checking the logs will be helpful to understand if everything is running fine. For example, the version code and version number we have passed as parameters should be displayed as part of the Gradle task, since we have printed them:

 

GradleLogging.png

 

At the end of the process, your artifact will contain the generated APK:

 

GenericAPK.png

 

Improving the generated file name

By default, the generated APK will be called app-release-unsigned.apk. There isn't any specific downside in using this name, but it may be hard to track which exact app and version is included inside the package. It would be better to give it a more meaningful name, maybe including also the version number. We can do it by modifying the build.gradle file included in the android/app folder. Towards the end of the file you will find a section called applicationVariants.all, which iterates all the files which are generated by the build process to configure them. This is how it looks like:

 

applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // https://developer.android.com/studio/build/configure-apk-splits.html
        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
}

The output object represents a single file that is produced by the build, so we can use it to change the file name thanks to the outputFileName property. This is how the section should look like after our change:

 

applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // https://developer.android.com/studio/build/configure-apk-splits.html
        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
        output.outputFileName = output.outputFileName
                        .replace("app-", "NavigationSample-")
                        .replace("unsigned", "")
                        .replace(".apk", "${variant.versionName}.apk")

    }
}

We're taking the outputFileName property and:

  • We replace the generic app- string with the name of our application (in my case, it's NavigationSample-).
  • We remove the unsigned string
  • We add, as suffix, the version number, which can be referenced with the ${variant.versionName} property.

Now, if we save the build.gradle file and we push it to our repository, Azure DevOps will trigger a new execution of the pipeline. At the end of the process, we will find in the artifacts an APK with a more meaningful name, like NavigationSample-2020.1.18.apk.

 

RealNameAPK.png

 

Deploy the application

Now that you have generated a signed package, you can create a release pipeline to do the deployment. You have many options, based on your scenario. If you have generated an AAP and you want to publish it on the Google Play Store, Azure DevOps offers a task for that. Another great option is to deploy your application to a group of testers, that will help you to validate the update before publishing it on the Store. In this case you can leverage App Center, the Microsoft platform to automate the build, deployment and testing of mobile and desktop apps. Also for this scenario Azure DevOps offers a dedicated task, you'll just need a free account on App Center.

 

Wrapping up

In this post we have learned how to create a CI pipeline for our React Native project to generate an Android application. We have created it alongside the Windows one we have already created in another post. Now, every time we're going to commit some new code to our repository, Azure DevOps will automatically build and deploy both the Windows and Android versions of our application. Once they have been validated, we can automatically deploy them to our users, regardless if we're using sideloading or the Store.

 

If you're building React Native applications for Android and iOS, there's also another option you can explore: App Center. Other than using it to perform the deployment, App Center supports also directly enabling CI/CD. You just need to connect it to your repository, specify that your project is based on React Native and setup a few parameters (like providing the private certificate and the passwords). App Center will take care of everything and it will automatically create a pipeline for you. In my case, I preferred to use Azure DevOps because I wanted more flexibility and to consolidate all the pipelines for my project (Windows, Android and in the future iOS) in a single place. However, App Center is a great choice if you're looking for a simple and reliable solution to automatically build and deploy your React Native projects.

 

Happy coding!

1 Comment

Thanks for Sharing this great blogpost with the Community :cool: