<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aditya Giri on Medium]]></title>
        <description><![CDATA[Stories by Aditya Giri on Medium]]></description>
        <link>https://medium.com/@adityagiri359?source=rss-184f854f033d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Vq8W2-xAlrMQO63gapcGzg.jpeg</url>
            <title>Stories by Aditya Giri on Medium</title>
            <link>https://medium.com/@adityagiri359?source=rss-184f854f033d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 05:51:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adityagiri359/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Digging Into Android App Startup API]]></title>
            <link>https://blog.stackademic.com/digging-into-android-app-startup-api-d2b40f47bd34?source=rss-184f854f033d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2b40f47bd34</guid>
            <category><![CDATA[app-startup]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[initialization]]></category>
            <dc:creator><![CDATA[Aditya Giri]]></dc:creator>
            <pubDate>Thu, 25 Dec 2025 04:34:26 GMT</pubDate>
            <atom:updated>2025-12-25T16:27:31.276Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ACuGjmNazX6wH98a_cv-ig.png" /></figure><p>While working on my multi-module project, I faced one challenge. The challenge is that I want to keep my Application class as clean as possible and avoid doing any heavy work there. My Application class resides in the app module.</p><p>In this project, I used a coil library for image loading. Documentation of the coil says that we need a global image loader for loading images and caching purposes. For this, we need to implement an SingletonImageLoader.Factory interface where we need to override a newImageLoader method that describes image loader properties and returns their instance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/995a46ee91fc68b7d350cc73e5104979/href">https://medium.com/media/995a46ee91fc68b7d350cc73e5104979/href</a></iframe><p>Now I want to move this image loader initialization part to another place. But where?</p><p>So, I’m starting r&amp;d how we initialize something during App startup. Then I found an android api named AppStartup Api . This Api called before Application.onCreate(). So this is what I am looking for.</p><h3><strong>How to Use?</strong></h3><p>There are two ways to use this api:</p><ol><li>Automatic Initialization</li><li>Manual Initialization</li><li><strong>Automatic Initialization</strong></li></ol><p>Step 1: Declare this dependency in the project.</p><pre>dependencies {    <br>implementation &quot;androidx.startup:startup-runtime:1.2.0&quot;<br>}</pre><p>Step 2: Create a class that extends the Initializer&lt;T&gt; abstract class.</p><p>This is a generic class, where T represents what instance we need to create, e.g. WorkManager.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f0f2a54410b8d1402c0a93e470bca44/href">https://medium.com/media/0f0f2a54410b8d1402c0a93e470bca44/href</a></iframe><p>So in my case, I don’t need to create any instance but just call the initialization method SingletonImageLoader.setSafe(this) in the onCreate method above.</p><p>In this class, we need to override two methods:</p><ol><li><strong>onCreate()</strong></li></ol><p>Where we do the initialization part and return the instance. Like, Initializing WorkManager:</p><pre>override fun create(context: Context): WorkManager {<br>// Some initialization Logic<br>        return WorkManager.getInstance(context)<br>    }</pre><p>2.<strong> dependencies()</strong></p><p>Where do we describe that our current initializer depends on another initializer for initialization purposes or not? If yes, then we need to pass that class in the list and return. This guarantees that the dependency initializer is executed first, after which our initializer runs.</p><pre>override fun dependencies(): List&lt;Class&lt;out Initializer&lt;*&gt;&gt;&gt; {<br>       <br>        return list(Initializer2::class.java , Initializer3::class.java)// Here we defined or pass which initializer we need to defined first.<br>    }</pre><p>Step 3: Add this initializer to the AndroidManifest.xml file.</p><pre>  &lt;provider<br>            android:name=&quot;androidx.startup.InitializationProvider&quot;<br>            android:authorities=&quot;${applicationId}.androidx-startup&quot;<br>            android:exported=&quot;false&quot;<br>            tools:node=&quot;merge&quot;&gt;<br>            &lt;meta-data<br>                android:name=&quot;com.aditya.example.CoilInitializer&quot; // Our initializer.<br>                android:value=&quot;androidx.startup&quot; /&gt;<br>        &lt;/provider&gt;</pre><p>So, when our app starts. Android os just sees our provider in the AndroidManifest file and initializes our component.</p><blockquote>There is one more point: if our initializer depends on another initializer, then we don’t need to add that initializer in the manifest because Android OS runs that initializer first, then it moves to our initializer.</blockquote><p>Let’s see manual Initialization.</p><p>2. <strong>Manual Initialization.</strong></p><p>Steps 1 and 2 are the same as above. But step 3 differs.</p><p>Step 3: We need to use the <strong>node:” remove”</strong> property in the manifest file. So that our initializer is removed during merging the Manifest.</p><pre>&lt;provider<br>    android:name=&quot;androidx.startup.InitializationProvider&quot;<br>    android:authorities=&quot;${applicationId}.androidx-startup&quot;<br>    android:exported=&quot;false&quot;<br>    tools:node=&quot;merge&quot;&gt;<br>    &lt;meta-data android:name=&quot;com.aditya.example.CoilInitializer&quot;<br>              tools:node=&quot;remove&quot; /&gt;<br>&lt;/provider&gt;</pre><blockquote>This node property used above when you have many initializers, and you want to initialize some manually. And don’t remove the provider itself because the AppInitializer class depends on it. We here just disable the Automatic Initialization, not remove.</blockquote><p>Then we need to use the <strong>AppInitializer</strong> class to initialize our Initializer. Call it where you need to initialize.</p><pre>AppInitializer.getInstance(context)<br>    .initializeComponent(CoilInitializer::class.java)</pre><h3>Why did we use the App Startup Api in our project?</h3><p>Before App Startup Api:</p><p>There are some library that wants to initialize their components during app startup time. And they also want to make sure that until initialization, no one can access their code. But at that time, there was no way to do these things. Android also does not support this use case.</p><p>But the library found a way to do it by using a content provider. Because content providers need to be initialized first during app startup, so that the app can use that provider for their use case.</p><p>The library uses the content provider below way:</p><pre>class LibraryInitProvider : ContentProvider() {<br><br>    override fun onCreate(): Boolean {<br>        val context = context ?: return false<br><br>        // ⚠️ Runs BEFORE Application.onCreate()<br>        LibrarySdk.init(context)<br><br>        return true<br>    }<br><br>    override fun query(...) = null<br>    override fun insert(...) = null<br>    override fun delete(...) = 0<br>    override fun update(...) = 0<br>    override fun getType(...) = null<br>}</pre><p>And add an entry in the manifest file :</p><pre>&lt;provider<br>    android:name=&quot;com.lib.LibraryInitProvider&quot;<br>    android:authorities=&quot;${applicationId}.lib-init&quot;<br>    android:exported=&quot;false&quot;<br>    android:initOrder=&quot;100&quot; /&gt;</pre><p>However, the problem is that you have used many libraries in your project, and if some of these libraries require early initialization, then they create their own content provider. As the number of providers increases, it affects our app&#39;s startup time.</p><blockquote>And one more thing, the content provider does not make for this type of use case.</blockquote><p>So taggle this issue, Android launches its own Api for this use case named <strong>App Startup Api</strong>.</p><p>This API uses a single InitializationProvider ContentProvider. Multiple initializers are registered and executed through this one provider. As a result, app startup time is reduced, and overall app performance improves.</p><p>In this article, we explored how and why to use the Android App Startup API. In the next article, we’ll look at another important Android API.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2b40f47bd34" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/digging-into-android-app-startup-api-d2b40f47bd34">Digging Into Android App Startup API</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding the Gradle Wrapper in Android]]></title>
            <link>https://proandroiddev.com/understanding-the-gradle-wrapper-in-android-e3ba6a4737ac?source=rss-184f854f033d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3ba6a4737ac</guid>
            <category><![CDATA[build-automation]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Aditya Giri]]></dc:creator>
            <pubDate>Tue, 02 Dec 2025 20:37:35 GMT</pubDate>
            <atom:updated>2025-12-02T20:37:35.794Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*woNoDte8FLOMwrvSNMo8zQ.png" /></figure><p>This is a continuation of our Gradle series — welcome to Part 2.</p><p><a href="https://medium.com/@adityagiri359/gradle-in-android-development-b6898f1be332">Read part 1 from here to understand the importance of Gradle.</a></p><p>In this article, we will explore the importance of the Gradle wrapper in our Android project setup.</p><h3>Initial Days of Gradle</h3><p>Have you ever downloaded Java on your system? What step do you follow?</p><ul><li>Install Java from their website.</li><li>Now run the .exe file and select the folder where all files are saved.</li><li>Now, open the System environment and save the Java bin folder path.</li><li>Now, check the Java installation in the command prompt and type j<strong>ava — version.</strong></li></ul><p>In the initial days of Gradle, developers should follow the above steps to use Gradle. Which is below:-</p><ul><li>Install the zip file from the Gradle website.</li><li>Extract the file and save it to your specific location.</li><li>Open System Environment and save the Gradle bin folder path.</li><li>Now check the Gradle installation by <strong>gradle — version.</strong></li></ul><blockquote>You can see in the initial days of Gradle, Gradle installation same as Java installation.</blockquote><h3>Problem of manual installation</h3><p>You can see that this work can be repeated when we need to update our Gradle version. Additionally, there is no guarantee that our teammates use the same Gradle version. After all, version consistency cannot always be ensured.</p><p>So that, if any issue occurred in another pc or computer. And then there is one phrase, the common <strong>“This works on my computer”,</strong> which was too annoying.</p><p>So that if any issue occurs due to any reason, you need to find or research it, which takes time and energy.</p><h3>Gradle Wrapper to the Rescue</h3><p>Open Android Studio and look at your folder structure. You will find some Gradle-related files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*NNn8mt5SpoIzhsEtYROjww.png" /></figure><ul><li>gradlew</li><li>gradlew.bat</li><li>gradle-wrapper.properties</li><li>gradle-wrapper.jar</li></ul><p>There are also Gradle build files, but ignore this for now.</p><p>We know that in the initial days, there is no proper way to install and use Gradle. However, in later versions, there is one feature that comes with <strong>Gradle Wrapper.</strong></p><blockquote>The above files are part of the Gradle wrapper.</blockquote><p>The First Two files are used for running the Gradle task.</p><ol><li>gradlew is used in Linux systems.</li><li>gradlew.bat is used in Windows.</li></ol><p>The next two files are under the wrapper folder.</p><ol><li><strong>gradle-wrapper.properties</strong> is a configuration file. See image below for more details:-</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*hbKtsrjcPRXTLvhEIOPzaA.png" /></figure><ul><li>In this image, you can see that we provide a URL link from which Gradle should download.</li><li>We also give the folder path where this zip file was downloaded and extracted, which is wrapper/dists.</li><li>The wrapper/dists is an important folder because whenever we run any task, help using gradlew.bat is used in Windows. It then checks our above configuration file and verifies that the mentioned Gradle version is present in the wrapper/dists folder. If it is not present, then it first downloads and then runs our task.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*xAiD8qTajlByahS_x-7tMg.png" /><figcaption>The above image is taken from dpuniversity’s Gradle guide.</figcaption></figure><p>2. <strong>gradle-wrapper.jar </strong>executes the Gradle build by using the settings defined in<strong> </strong><strong>gradle-wrapper.properties, </strong>enabling your Gradle tasks to run. Let’s see an example below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P4OE3lU8NewoqBu0eVNBKQ.png" /><figcaption>Complete Flow Of What gradle-wrapper.jar file did !</figcaption></figure><p>There’s one thing you didn’t pay attention to: what does <em>bin</em> actually mean?</p><p>bin means binary. Here are two types of download methods.</p><ol><li>all ( which download binary + source code + documentation)</li><li>bin( only binary, and it is recommended because it is very lightweight.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*6-ZDpNlPxu72DEQ11gFxmA.png" /><figcaption>The above image is taken from dpuniversity’s Gradle guide.</figcaption></figure><p>That’s all for now. We covered the importance of the Gradle Wrapper. We’ll continue with more in the next part of this series.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3ba6a4737ac" width="1" height="1" alt=""><hr><p><a href="https://proandroiddev.com/understanding-the-gradle-wrapper-in-android-e3ba6a4737ac">Understanding the Gradle Wrapper in Android</a> was originally published in <a href="https://proandroiddev.com/">ProAndroidDev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gradle in Android Development]]></title>
            <link>https://blog.stackademic.com/gradle-in-android-development-b6898f1be332?source=rss-184f854f033d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6898f1be332</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[gradle]]></category>
            <category><![CDATA[dependency-management]]></category>
            <dc:creator><![CDATA[Aditya Giri]]></dc:creator>
            <pubDate>Fri, 14 Nov 2025 14:15:17 GMT</pubDate>
            <atom:updated>2025-12-04T07:25:42.034Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Android Gradle" src="https://cdn-images-1.medium.com/max/500/1*hbyDQKecypJACRkPyO_3WQ.png" /></figure><p><strong>This is part 1 of this series.</strong></p><p>We frequently use Gradle in our Android projects. Sometimes, we run into Gradle problems or bugs during development. Fixing these can take hours or even days 😵. Because of this, we often get frustrated with Gradle when these errors happen, as resolving them can be time-consuming. But let’s explore how Gradle fits into Android development.</p><p>Let’s see before the Gradle era. How were things going that time?</p><h4><strong>Before Gradle Era</strong></h4><p>Before moving on, I would like to share one of my experiences. We know about Maven tool. When I was working on my Java Swing desktop app project in my college days, I chose Maven for my project.</p><p>This is a <a href="https://github.com/Aditya-Giri1234/NoteAppClone">notepad clone desktop app</a>. During the development, I need to add a third-party code(library) to my project. That time Maven was new to me, and I wanted to add JTattoo library to my project. So I&#39;m just starting how to integrate into my project. And got a solution that downloads the first jar file of that library and adds it to the manual in my project.</p><p>This is my first experience adding a 3rd party library to a project. This is a time when I’m new to development. When I entered the Android development world, I found Gradle tool. the same way we used to add jar files before Gradle tool existed, or early days of Android.</p><p>Let’s see how things below handle before Gradle.</p><ul><li>Dependency Management</li><li>Performing Compiling</li><li>Performing Custom Task</li><li>How flavour or build variant perform</li><li>How subproject handle</li><li>How custom classes are generated</li><li>Many More.</li></ul><blockquote>Before Gradle, we used to write a custom build script. Like using Ant, etc.</blockquote><h4><strong>What is a build script? Hope that&#39;s easy to write?</strong></h4><p>Below is an example of compiling our project. Let’s see how it looks.</p><pre>&lt;project name=&quot;MyApp&quot; default=&quot;compile&quot;&gt;<br>  &lt;property name=&quot;src.dir&quot; value=&quot;src&quot; /&gt;<br>  &lt;property name=&quot;build.dir&quot; value=&quot;build&quot; /&gt;<br>  &lt;property name=&quot;classes.dir&quot; value=&quot;${build.dir}/classes&quot; /&gt;<br><br>  &lt;target name=&quot;init&quot;&gt;<br>    &lt;mkdir dir=&quot;${classes.dir}&quot; /&gt;<br>  &lt;/target&gt;<br><br>  &lt;target name=&quot;compile&quot; depends=&quot;init&quot;&gt;<br>    &lt;javac srcdir=&quot;${src.dir}&quot; destdir=&quot;${classes.dir}&quot; /&gt;<br>  &lt;/target&gt;<br><br>  &lt;target name=&quot;jar&quot; depends=&quot;compile&quot;&gt;<br>    &lt;jar destfile=&quot;build/myapp.jar&quot; basedir=&quot;${classes.dir}&quot; /&gt;<br>  &lt;/target&gt;<br>&lt;/project&gt;;</pre><p>Let’s understand what happened step by step:-</p><p>Step 1: Create folders (Target: init)</p><pre>&lt;target name=&quot;init&quot;&gt;<br>    &lt;mkdir dir=&quot;${classes.dir}&quot;/&gt;<br>&lt;/target&gt;</pre><ul><li>This creates the folder build/classes (where compiled class files will go).</li></ul><p>Step 2: Compile Java code (Target: compile)</p><pre>&lt;target name=&quot;compile&quot; depends=&quot;init&quot;&gt;<br>    &lt;javac srcdir=&quot;${src.dir}&quot; destdir=&quot;${classes.dir}&quot;/&gt;<br>&lt;/target&gt;</pre><ul><li>This compiles all .java files from the src folder.</li><li>Outputs .class files into build/classes .</li><li>It depends on the init task, so it first runs mkdir .</li></ul><p>Step 3: Package into JAR (Target: jar)</p><pre>&lt;target name=&quot;jar&quot; depends=&quot;compile&quot;&gt;<br>    &lt;jar destfile=&quot;build/myapp.jar&quot; basedir=&quot;${classes.dir}&quot;/&gt;<br>&lt;/target&gt;</pre><ul><li>Takes all .class files.</li><li>Puts them into a .jar file called myapp.jar inside the build/ folder.</li></ul><p>Final Output:</p><p>This script turns your:</p><ul><li>.java → .class → myapp.jar</li></ul><p>If You Run:</p><pre>ant</pre><p>It runs the compile task (default), which:</p><ol><li>Runs init (creates folders)</li><li>Compiles code</li><li>Then you can run ant jar to package it</li></ol><p>What a way to compile our code 😵. But what if we make a big project where we need a custom build variant, a custom task, a custom flavour, manage large dependencies, and have too many sub-projects? How much do we need to write this script? And also, we need to add manual jar files for the library.</p><p>Writing this script takes all our brain power and energy. That time developer had no option and had to use this. But nowadays we don’t need to do this thanks to <strong>“Gradle Build System”</strong>.</p><h4>How Gradle solve this problem?</h4><p>Gradle says: “Whatever dependencies, build variants, flavours, or sub-projects you need, just declare them in the build.gradle files. I will take care of everything else.”</p><p>Developer: “Oh, thanks! You are our lifesaver.”</p><p>We’ll explore more on this topic in the next part of the series. Follow for more articles like this.<br><a href="https://medium.com/proandroiddev/understanding-the-gradle-wrapper-in-android-e3ba6a4737ac">Read Part 2 from here — Understanding the Gradle Wrapper in Android.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6898f1be332" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/gradle-in-android-development-b6898f1be332">Gradle in Android Development</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>