<?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 Wandering Soul on Medium]]></title>
        <description><![CDATA[Stories by Wandering Soul on Medium]]></description>
        <link>https://medium.com/@wandering.soul?source=rss-c4bd05f9dee5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*rqUhArs4bl1Fcvv695OwSQ.jpeg</url>
            <title>Stories by Wandering Soul on Medium</title>
            <link>https://medium.com/@wandering.soul?source=rss-c4bd05f9dee5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 17:08:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wandering.soul/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[Jetpack Compose — What and Why?]]></title>
            <link>https://medium.com/@wandering.soul/jetpack-compose-what-and-why-59aa2d6e453c?source=rss-c4bd05f9dee5------2</link>
            <guid isPermaLink="false">https://medium.com/p/59aa2d6e453c</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[jetpack-compose]]></category>
            <category><![CDATA[jetpack]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Wandering Soul]]></dc:creator>
            <pubDate>Wed, 25 Aug 2021 14:23:28 GMT</pubDate>
            <atom:updated>2021-08-25T18:00:58.113Z</atom:updated>
            <content:encoded><![CDATA[<h3>Jetpack Compose — What and Why?</h3><h3>Why are we talking about it in the first place?</h3><p><strong><em>Early adopters have more pros than cons:</em></strong></p><p><strong><em>Pros:</em></strong></p><p><em>1. You will know how the framework has evolved and how it&#39;s working underneath.</em></p><p><em>2. You can contribute to building the mature framework by providing continuous feedback to developers.</em></p><p><strong><em>Cons:</em></strong></p><ol><li><em>Frequent changing APIs and its breaking updates</em>.</li><li>You can feel like wasting your time sometimes.</li></ol><h3>What is Jetpack Compose?</h3><p>Jetpack Compose is a modern <strong>declarative UI Toolkit</strong> for Android.</p><p>Why another UI toolkit when we already have one in hand? What is the problem with the current one?</p><ol><li>The current UI toolkit was built in 2008 (updates minor and major have been there, but even the updates were with the same initial CodeBase). The Code is legacy and complicated. It’s that legacy at places that Google is restricted to implement certain features just for this reason.</li><li><strong>MAIN REASON</strong>:: Google is in a process of separating SDK with the Android-specific code. extracting development APIs to different package (AndroidX) from the Android-specific code was the first step, once the programming-wise separation is still in process, they have already started doing the same for layouts. The current layout code is coupled with Android-specific code and hence separating them is a need of time.</li><li>Just like, API-compatibility with the Android version is a thing of the past, the same would follow for layout.</li><li>The world has changed around for Google and Google has to follow foreseeing the future. SwiftUI for Apple, React, flutter itself, etc.</li><li>In 2008 when android was launched, in that period, recreating the screen each time was not feasible coz of resource crunch ( There was no GPU ), so the only way to change something on-screen is by reaching that view ( or widget ) through parent (using findViewById or something ) and then changing that view’s state. Initially screen state used not to change much in any app. Hence this way worked well. But over time, with UI enhancements, animation, much better available resources, etc now the state of any screen changes much frequently, and hence it is error-prone.</li><li>The current UI toolkit is imperative in nature while the Jetpack Compose is declarative.</li></ol><h4>Declarative vs Imperative programming?</h4><ol><li>“Imperative” is telling the computer what to do and how to do it.</li><li>“Declarative” is just telling the computer what to do and you don&#39;t care about how it does it.</li><li>SQL is declarative programming. You just write what you want in simple English. Can’t even think of writing queries in Java.</li><li>array[] in 5 to 20 -&gt; declarative (its a sample)</li><li>array[] for(i =5;i≤20;i++){} -&gt; this kind is imperative. Why -&gt; Here, we’re telling what we want and also telling how we want it (for can be replaced with while or do-while, etc).</li><li>The more High level you’re, the more declarative it is, and the same for imperative.</li></ol><p>The current UI toolkit is Imperative in nature, which means it needs more code from you to define pieces of stuff. While Jetpack Compose is declarative in nature.</p><p>In the imperative style, you would typically go to ViewB’s owner and retrieve the instance b using selectors or with findViewById or similar, and invoke mutations on it (and implicitly invalidate it)</p><p>suppose you need a view with color=red and a child for it,</p><p>// Imperative style</p><blockquote>b.setColor(red)</blockquote><blockquote>b.clearChildren()</blockquote><blockquote>ViewC c3 = new ViewC(…)</blockquote><blockquote>b.add(c3)</blockquote><p>Here, when you write clearChildren and then objectify child before adding (This is how of Imperative)</p><p>// Declarative style</p><blockquote>return ViewB( color: red, child: ViewC(…), )</blockquote><p>Now, here we don’t care how you do it, you just tell what you want as a result.</p><p>NOTE: Declarative and Imperative are not binary.</p><h3>Compose</h3><ol><li>Manipulating views manually increases the likelihood of errors. So, widgets are immutable in Compose.</li><li>You update the UI by calling the same composable function with different arguments. This makes it easy to provide state to architectural patterns such as a <a href="https://developer.android.com/reference/androidx/lifecycle/ViewModel">ViewModel</a>. Remember MVI.</li><li>The technique works by conceptually regenerating the entire screen from scratch, then applying only the necessary changes.</li><li>One challenge with regenerating the entire screen is that it is potentially expensive, in terms of time, computing power, and battery usage. Compose intelligently chooses which parts of the UI need to be redrawn at any given time. This redrawing process is called <strong>Recomposition.</strong></li><li><strong>This does have some implications for how you design your UI components. </strong>The better you design your UI components ( less corruption you do while making the UI ), You provide Compose to use its intelligent power of <strong>Recomposition</strong>.</li><li>In here, if the value of a field has to be changed, you run the Composable with different data and everything gets recreated again. Now, each time you provide a state (in terms of a model) as an argument, the Model will have fields in such a way that suppose a checkbox is there in the UI, so in one state ( model ), one field of the model will be true and in other, it will be false. You’ll always provide the entire model (State).</li></ol><p><a href="https://developer.android.com/images/jetpack/compose/mmodel-flow-data.png">https://developer.android.com/images/jetpack/compose/mmodel-flow-data.png</a></p><p>7. When the user interacts with the UI, the UI raises events such as <strong>onClick </strong>callback.</p><p>8. When the state changes, the composable functions are called again with the new data. This causes the UI elements to be redrawn (Recomposition).</p><p><a href="https://developer.android.com/images/jetpack/compose/mmodel-flow-events.png">https://developer.android.com/images/jetpack/compose/mmodel-flow-events.png</a></p><p>9. In recomposition, Other functions that don’t depend on the value are not recomposed.</p><h3><strong>Lastly</strong></h3><p><strong>Compose compiler</strong> is a custom Kotlin compiler plugin that takes composable functions and automatically updates the UI hierarchy.</p><p><a href="https://www.reddit.com/r/androiddev/comments/g6gjug/jetpack_compose_is_going_to_use_skia_for/">https://www.reddit.com/r/androiddev/comments/g6gjug/jetpack_compose_is_going_to_use_skia_for/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59aa2d6e453c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step by step guide to test In App Update implementation]]></title>
            <link>https://medium.com/@wandering.soul/step-by-step-guide-to-test-in-app-update-implementation-68f9ed3619c?source=rss-c4bd05f9dee5------2</link>
            <guid isPermaLink="false">https://medium.com/p/68f9ed3619c</guid>
            <category><![CDATA[android-testing]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[in-app-update]]></category>
            <category><![CDATA[android-test]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Wandering Soul]]></dc:creator>
            <pubDate>Wed, 10 Feb 2021 13:09:42 GMT</pubDate>
            <atom:updated>2021-02-10T13:09:42.817Z</atom:updated>
            <content:encoded><![CDATA[<p>As of today, in-app-update testing can not be done for a debug build. You don’t need to put your apk to PlayStore to test also. The best way to test in-app-update is by using internal-app-sharing.</p><p>If you follow the below steps one-by-one, you’ll be able to test successfully.</p><ol><li>To test the app, a tester has to first enable Internal-App-Sharing in PlayStore, follow this link for the same, <a href="https://stackoverflow.com/questions/57478894/how-to-enable-internal-app-sharing-for-android#57478895">How to Enable Internal App Sharing for Android?</a></li><li>If you’re brave enough to understand the official documents, then simply follow this link to set-up in-app-update testing in your device, <a href="https://developer.android.com/guide/playcore/in-app-updates#internal-app-sharing">check the official documentation</a></li></ol><p>Here, I’ll be writing the same in easy words.</p><p>Once you’re done with setting up internal-app-sharing in Play-Store, make sure that you have to upload 2 apks to internal-app-sharing on Play-Console and hence generate 2 links. Both apks will be signed using the same signing-key (need not be the same as the one you use to sign for production, any dummy signing-key would work).</p><p>3. First you upload an apk with in-app-update implementation with lower VersionCode (say, 100) to internal-app-sharing on play console.</p><p>To know, How to upload apk to internal-app-sharing on Play-Console, follow this link, <a href="https://support.google.com/googleplay/android-developer/answer/9844679?visit_id=637437125318137239-1277036129&amp;rd=1">https://support.google.com/googleplay/android-developer/answer/9844679?visit_id=637437125318137239-1277036129&amp;rd=1</a></p><p><strong>NOTE</strong>: make sure, you have uninstalled any preinstalled app with the same package-name in your device.</p><p>4. Now you copy the link of the app you uploaded to internal-app-sharing on. the play console and use this link to install the app on your device.</p><p>NOTE: Before installing, make sure the email-id you’re using on play-store has been added in the mail-list on internal-app-sharing on play-console.</p><p>5. Now, once you’ve installed the app using the link. Now, you need to again create a new signed apk with higher VersionCode (say, 101). And upload this apk to internal-app-sharing.</p><p>6. Now, copy the link with higher VersionCode from internal-app-sharing. Click on this link on your device, it will take you to play-store but this time, update button will be enabled rather than install button as app is already installed in your device with lower VersionCode.</p><p>7. You don’t have to click the update button on PlayStore. You just have to click the link and hence open the screen on PlayStore. Now close PlayStore app.</p><p>8. Now, you can launch the already installed app from your device.</p><p>If your implementation of in-app-update is fine, launching the app would appear the dialog from PlayStore for update.</p><p>************Don’t forget to clap if everything works well.*************</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68f9ed3619c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[20 things to learn in your 20s ( in 2020)]]></title>
            <link>https://medium.com/@wandering.soul/20-things-to-learn-in-your-20s-in-2020-3247ab4bdc9d?source=rss-c4bd05f9dee5------2</link>
            <guid isPermaLink="false">https://medium.com/p/3247ab4bdc9d</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[lifestyle]]></category>
            <category><![CDATA[attitude]]></category>
            <dc:creator><![CDATA[Wandering Soul]]></dc:creator>
            <pubDate>Thu, 16 Jan 2020 10:27:08 GMT</pubDate>
            <atom:updated>2020-01-17T11:08:58.899Z</atom:updated>
            <content:encoded><![CDATA[<p>The 20s is probably the age-range when we all become self-reliant. When we jump from one-quarter of life to another. When we go from being dependent to become self-reliant and for many from being dependent to become self-reliant to make others dependent on you. Hence, it’s the most important 10 years that can shape the world for us, that can decide our further journey into life, that can decide for you whether you&#39;re gonna retire in your 40s or not?, that can decide for you whether you’ll have a satisfactory 3rd part of life or not ( part of life when others are dependent on you ).</p><p>Hence it’s very important to learn the basics of life, basics that can help build your attitude towards life.</p><p>Let’s start.</p><p><strong>1. Underestimation of the long term and Overestimation of the short term</strong></p><p>This we all do a lot. We all have been in a situation when we make a short term plan and when we can’t execute it properly or we can’t finish what we had decided to finish and we lose hope and sit back without even trying further. That’s exactly what I mean by Overestimating the short term. Short term plans are made to fit in some long term plan to be completed.</p><p>2. <strong>You don’t need people around to be happy</strong></p><p>It’s self-explanatory. You’ll not have people entertaining you throughout your life, you have to learn to be happy even if no one is around.</p><p>3. <strong>Social-Networking</strong></p><p>Is it not contradicting the 2nd point? Noh, it is not. By social-networking I mean that one should learn to socialize with random people. You should learn to talk to people you have never met with, never been with. This can help you at different points in life.</p><p>4. <strong>Learn to cook</strong></p><p>Cooking can be fun as well as soothing at times. You should learn cooking some delicious dishes not just for you but to have other people also at your side. You had a long day, enter the kitchen and start cooking your fav dish, cooking something your own that can make you orgasm is the best satisfaction. I bet on this.</p><p>5. <strong>Make your body as flexible as possible</strong></p><p>Have you seen some people taking leaves more often stating being sick than others? Have you ever thought why is that some people fall sick even by 2 drops of drizzling and others don&#39;t even when they are all drenched in rain? Make your body as rough as you can. Even Army personnel gets sick but their ability to bear the natural uncertainty is more than ours for sure simply because they are made to withstand such weather.</p><p><strong>6. Learn to search the Internet</strong></p><p>In this internet age, if you don&#39;t know where to find the best and reliable answer of your curiosity then you’re certainly losing something.</p><p>7. <strong>Make plans and be flexible to it</strong></p><p>We all make plans to do something, be it a short-term plan or a long-term plan. But something that not all of us do is to be ready to make changes in our plans if needed. Most of us find it as our defeat to make changes before fulfilling our plans. But remember, data that today you’ve might change tomorrow and hence the plan that you make today with the data that you have today has to be changed tomorrow with the data of tomorrow.</p><p>8. <strong>Concealing yourself at times is not being fake but being smart</strong></p><p>Dig this deep inside your mind that “You can’t be yourself in front of everyone”.</p><p><strong>9. Family</strong></p><p>Keep your family at the top in all the priority list that you make.</p><p><strong>10. Case Studies</strong></p><p>Anything and everything that happens around you is a case study for you. If your office environment is not good and people are back-bitching about everyone, you have to understand the root cause of this and learn from it. Suppose if you come up with your own startup tomorrow, you should not be making the same mistake there so that the same environment doesn&#39;t appear over there. It’s just an example. It’s about every other thing that you go through.</p><p><strong>11. Saving</strong></p><p>Remember this clearly that Share Market was at an all-time high before the 2008 financial crisis, it was at an all-time high before 1929 great depression. I mean to say that the government and all these agencies have never been for us, they will never give you a hint of bad times so that you start preparing for it. You have to be ever-prepared. If I state the general saying, you should keep at least 6 months of an emergency fund with you all the time.</p><p><strong>12. Investment</strong></p><p>Learn this, in general, You have 2 ways to get rich, one is by starting your own business and other is to invest in already started business of others. Second is the easier one coz here someone else with better understanding of business is working on your behalf.</p><p><strong>13. Gold</strong></p><p>If there is something which could retain its value for over the period of the last millennium then it’s precious metals. It has saved so many people in their hardest times, and it’ll continue doing so. Remember this, it’s up to the government agencies to decide on the future of fiat currency ( dollar, pound, etc) but gold will remain there even in the hardest financial transition of time.</p><p><strong>14. Reading and Writing</strong></p><p>Learn to read and write at frequent intervals. It helps your thoughts to be inline.</p><p><strong>15. Saying “NO”</strong></p><p>Trust me it’s not as easy as it sounds. We don&#39;t want to be seen rude, mean and what not. But at the same time, it’s one of the best you can learn in your 20s. Say “NO” whenever required.</p><p><strong>16. Make a Resume in advance</strong></p><p>A good resume is one that speaks on your behalf. You should make a resume of your future-self by stating all that you want it to speak for your future-self. This way you state what’s the real gap that you have to cover to reach your future-self and work on it.</p><p><strong>17. Understand how society works</strong></p><p>It includes learning the division in society, how much time generally people take to jump from one division to another and what does it take to make a transition? Go deeper to know about your society.</p><p><strong>18. Learn the survival nature</strong></p><p>Transition is the root of survival in our world. Nokia couldn’t make a transition in a changing world hence it perished, the same for Kodak. Learn that however big a company looks like today it can go bust tomorrow. This rule can help you in your long-term investment too.</p><p><strong>19. Don’t panic in the midst of bad news</strong></p><p>9/11 was the biggest tragedy of modern times. The world is still here.</p><p><strong>20. Learn to clap for the article.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3247ab4bdc9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unit vs Nothing in Kotlin]]></title>
            <link>https://medium.com/@wandering.soul/unit-vs-nothing-in-kotlin-1083fca51d5c?source=rss-c4bd05f9dee5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1083fca51d5c</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[nothing]]></category>
            <category><![CDATA[unit]]></category>
            <dc:creator><![CDATA[Wandering Soul]]></dc:creator>
            <pubDate>Mon, 12 Aug 2019 13:05:38 GMT</pubDate>
            <atom:updated>2019-08-19T15:56:57.896Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Unit</strong></h3><p>Unit is same as <strong>void</strong> of Java. void in java is a keyword but <strong>Unit</strong> is an Object in Kotlin.</p><p>Now if a function returns Unit in Kotlin, it means that it doesn’t return anything meaningful, that function just executes a bunch of code and gives back the <strong>execution flow</strong>.</p><h3><strong>Nothing</strong></h3><p>Nothing is a different kind altogether. You can’t relate it with anything in Java. <strong>There is nothing as such as Nothing in java.</strong></p><p>Nothing means the <strong>end of execution</strong>. If a function returns Nothing, means literally nothing it returns. Not even the <strong>execution flow</strong>.</p><p>Nothing is like a black hole, anything that goes in doesn’t come out, Not even the light (light is “execution flow” here). In the case of Unit, least light comes out.</p><p>So, if a function returns Nothing, the flow of code ends there and anything written after that is <strong>Unreachable</strong>.</p><p>Now see the code below,</p><pre>fun main() {<br>    unitFun()<br>    println(&quot;after unit&quot;)<br>    nothingFun()<br>    println(&quot;after nothing&quot;)   //warning - &quot;unreachable code&quot;<br>}<br><br>fun nothingFun(): Nothing {<br>    println(&quot;inside nothing&quot;)<br>    throw Exception()<br>}<br><br>fun unitFun(): Unit {<br>    println(&quot;inside unit&quot;)<br>}</pre><p>Output will be,</p><pre>inside unit<br>after unit<br>inside nothing<br>Exception in thread &quot;main&quot; java.lang.Exception</pre><p><strong>NOTE:</strong> you get warning as soon as you write</p><pre>println(&quot;after nothing&quot;)     UnReachable Code</pre><p>And you know the reason, it’s because nothingFun doesn’t even send back the execution flow.</p><p>One more thing to complete this here is, any function that returns Nothing has to throw an exception of any kind.</p><p><strong>REASON:</strong> If you write some general statement (and not throw an exception) then the function will match the return type and we don’t have anything that returns Nothing, means we don’t have anything that sucks the execution flow and never returns it back. Everything returns something, even Unit is something.</p><p>Now, one can say that Nothing is a class so we can make object of it and return that itself. Nohhhhhhh? A big nohhhh?</p><p>Nothing class has one constructor but it is private, so you can’t even make an object of it.</p><h4><strong>Last Bit</strong></h4><p>Behind the scene, Unit is converted into void(small v) in the decompiled byte code while Nothing is converted into Void(capital V).</p><p>see the below code,</p><pre>var user = null               //First<br>var user : User? =null        //Second</pre><p>Here, the Second statement shows, <strong>user</strong> of Nullable-User type. What is the type of <strong>user</strong> of the first statement?</p><p>any guess?</p><p>It’s <strong>Nullable-Nothing</strong> type.</p><p>try to see the first statement as</p><pre>var user : Nothing? = null</pre><p>Now what’s happening under the hood,</p><pre>Void user = (Void)null;              //First<br>Integer user = (Integer)null;        //Second</pre><p>Don’t forget to clap and you can clap 50 times.</p><p>************CLAP CLAP CLAP CLAP CLAP CLAP ************</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1083fca51d5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Safe calls(?.) vs Null checks(!!) and understanding NPE in Kotlin]]></title>
            <link>https://medium.com/@wandering.soul/safe-calls-vs-null-checks-and-understanding-npe-in-kotlin-a854ace53987?source=rss-c4bd05f9dee5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a854ace53987</guid>
            <category><![CDATA[nullpointerexception]]></category>
            <category><![CDATA[kotlin-beginners]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Wandering Soul]]></dc:creator>
            <pubDate>Mon, 12 Aug 2019 10:44:34 GMT</pubDate>
            <atom:updated>2019-08-19T15:56:01.930Z</atom:updated>
            <content:encoded><![CDATA[<p>In Kotlin, references can be of 2 types, Nullable and NotNull.</p><pre><strong>1. var str</strong>:String = String()   // NotNull type</pre><pre>@NotNull<br><strong>private </strong>String <strong>str </strong>= <strong>new </strong>String();    // java equivalent of NotNull</pre><pre><strong>2. var str2</strong>:String ?= <strong>null     // </strong>Nullable</pre><pre>@Nullable<br><strong>private </strong>String <strong>str2</strong>;        // java equivalent of Nullable</pre><p>You see those annotations in java equivalent snippet, so even in Java, we can make our references as either NotNull or Nullable by using those annotations.</p><p>Now, NotNull and Nullable are two different types altogether. You can’t assign a Nullable into NotNull and vice-versa.</p><p>So, following is not allowed in Kotlin.</p><pre><strong>str </strong>= str2</pre><blockquote>it’ll throw a compile time check saying “<strong>Type MisMatch. Required : String and Found : String?”</strong></blockquote><p>Here, <strong>String</strong> is NotNull(that is str) and <strong>String?</strong> is Nullable(that is str2).</p><blockquote>Wherever you see “?” it’s Nullable</blockquote><p>Now, until this point, you get a compile-time check so you can’t even run your code. To get around, you have 2 options here,</p><ol><li>You add “!!” to str2</li></ol><pre><strong>str </strong>= <strong>str2</strong>!!</pre><p>This happens behind the scene if you go this way</p><pre>if(str2==null)<br>Intrinsics.<em>throwNpe</em>();</pre><p>So if str2 is null, <strong>KotlinNullPointerException</strong> you’ll get.</p><p>This is not something we want.</p><p>2. You add an operator toString() to str2.</p><pre><strong>str </strong>= <strong>str2</strong>.<em>toString</em>()</pre><p>Behind the scene,</p><pre><strong>str </strong>= String.<em>valueOf</em>(<strong>this</strong>.<strong>str2</strong>);</pre><p>So now, even if str2 is null, you won’t get <strong>KotlinNullPointerException, </strong>but str will store null as String.</p><p>So, if str2 is not null, then str will be stored with the value of str2. But if str2 is null here, <strong>str=”null”</strong>.</p><p><strong>Note:</strong> It’s not null but “null”.</p><p>So in going the first way, you’ll get NPE if str2 is null as by writing !!, you’re allowing it to throw NPE.</p><p>Remember, in the above cases, str in NotNull type and str2 is Nullable. And we’re doing our operation on NotNull type after storing the value of Nullable into str. So we’re not doing anything(any operation) on Nullable type here.</p><p>Operations like,</p><pre><strong>var </strong>a = <strong>str</strong>.<strong>length    // </strong>and other opeartions too</pre><p>Here, as str is NotNull, so it’s very much feasible to have an operation on NotNull type, coz it’s NotNull.</p><p>Enough confused? Read the statements again after inhaling.</p><p><strong>What if we perform an operation on Nullable type.</strong></p><pre><strong>var </strong>b = <strong>str</strong>.get(2)     //first operation<br><strong>var </strong>c = b.<em>isLetter</em>()    // second operation</pre><p>Above statements are possible and normal in Kotlin (str is NotNull).</p><pre><strong>var </strong>b = <strong>str2</strong>.get(2)     // first<br><strong>var </strong>c = b.<em>isLetter</em>()     //second</pre><p>In the above statements, str2 is Nullable.</p><p>for first statement itself, we will get a compile-time check saying <strong>“only safe(?) or non-null(!!) asserted calls are allowed on a Nullable receiver of type String?”.</strong></p><p>So what it is simply saying is, str2 is Nullable, So in case str2 is null so performing an operation over null will throw NPE. Hence either explicitly tell that you’re as a developer okay with NPE(null pointer exception) by writing “!!” OR make the operation safe from NPE by writing “?”.</p><p>So, now</p><pre><strong>var </strong>b = <strong>str2!!</strong>.get(2)     // first<br><strong>var </strong>c = b.<em>isLetter</em>()     //second</pre><p>Either you write the above way, where again behind the scene, it is</p><pre>if(str2==null)<br>Intrinsics.<em>throwNpe</em>();</pre><p>So, if str2 is null when get(2) operation is happening, you’ll get NPE (KotlinNullPointerException to be exact) at the first statement itself. Here, by writing !!, you as a developer explicitly telling that you’re okay with NPE.</p><p>NOTE: It’s not that you’ll always get NPE even in this case. You will only get it when str2 is null.</p><p>Now if you wanna avoid NPE, you can use “?” as</p><pre><strong>var </strong>b = <strong>str2?</strong>.get(2)     // first</pre><p>Now what it will do is, behind the scene this happens,</p><pre>Character b = str2 != <strong>null </strong>? str2.charAt(2) : <strong>null</strong>;</pre><p>Now see carefully, First, it’s doing the charAt(2) operation only when str2 is not null and second it’s storing null to Object type (not primitive type) Character if str2 is null.</p><p>Nowhere it’s throwing NPE even if str2 is null.</p><p>Now, remember, in the case of “!!”, flow was not even going to second statement if str was null as at first statement itself it throws NPE and flows stops there.</p><p>But in the case of “?”, now b is of Object Type which can be null (Nullable type) so flow will go to second statement and there to you have to handle it.</p><pre><strong>var </strong>c = b.<em>isLetter</em>()</pre><p>Now, as b is Nullable, so you’ll get compile-time check saying the same thing “<strong>only safe(?) or non-null(!!) asserted calls are allowed on a Nullable receiver of type Char?</strong>”</p><p>So again back to the same rule, !! or ?.</p><p>Again, !! will result in NPE if b is null and ? will store null in c if b is null.</p><p><strong>If you have read it carefully, you would have noticed one thing that NPE is possible only if the developer intentionally allows it to happen in Kotlin (by using !!).</strong></p><p>Don’t forget to</p><blockquote>********************CLAP CLAP CLAP*******************</blockquote><p>Do you know? You can clap for 50 times.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a854ace53987" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[History of Work Manager — Jetpack Android]]></title>
            <link>https://medium.com/@wandering.soul/history-of-work-manager-jetpack-android-acef9ff07a6?source=rss-c4bd05f9dee5------2</link>
            <guid isPermaLink="false">https://medium.com/p/acef9ff07a6</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[workmanager]]></category>
            <category><![CDATA[architecture-components]]></category>
            <category><![CDATA[jetpack]]></category>
            <dc:creator><![CDATA[Wandering Soul]]></dc:creator>
            <pubDate>Wed, 19 Jun 2019 08:40:49 GMT</pubDate>
            <atom:updated>2019-07-07T07:24:01.877Z</atom:updated>
            <content:encoded><![CDATA[<h3>History of Work Manager — Jetpack Android</h3><p>This article is about the historical path to the Android Architecture Component’s WorkManager.</p><h4>Handler, Looper, and Timer</h4><p>If you want a certain task to be done in the background but you&#39;re sure that your app would be running in the foreground when that work will be executing, then the best you can do is to use <strong>Handler</strong>. Now if you want that task to be executed at a certain time interval, then you can use <strong>Timer</strong> with Handler.</p><p><strong>NOTE:</strong> Background doesn’t mean that the running task will also have a different thread. <strong><em>Background</em> just means that the task doesn’t have any UI</strong>.</p><p>Now, if you’re performing some heavy task (some heavy computation) in the background, then you can also use <strong>Thread</strong> in association with Handler and Timer.</p><p>But remember, the task here can’t be executed if your app goes in the background or is killed.</p><p>We won’t go in the codes as it’s not in the scope of this article.</p><h4>Service</h4><p>To overcome what we had as a drawback in the case of Handler, we can use Services.</p><p>Services are very powerful as you can even run a task if your app is not in the foreground.</p><p>Wait!</p><p>Then what is the problem with Service? Why go with WorkManager?</p><p>Service runs in the background, that doesn’t mean it has its own thread to work on. As I said before, <strong>Background just means that the task doesn’t have any UI</strong>.</p><p>What if you have to perform some heavy task?</p><p>Then we can use create a new thread inside our Service and perform our task on that thread.</p><p>Again, then why WorkManager?</p><p>There is a dark side to using services.</p><p>It used to drain the battery too fast. But back then, when there was no other possible stuff to perform background task than service, Every developer was doing whatever they wanted in the background without any restrictions.</p><p>Starting with <strong>Marshmallow 6.0 (API 23)</strong> and then followed by <strong>Nougat 7.0 (API 24)</strong>, <strong>Doze mode</strong> was then introduced.</p><p>After the user turns off the screen of the device, the doze mode kicks in and disables the network, syncs, GPS, alarms and wifi scans for services. It stays on up until the user turns on the screen or connects to the charger. The idea was to reduce the number of apps doing the unimportant jobs and in doing so, saves a user’s battery.</p><p>Here if you see, doze mode kicks in only when a user turns off the device. So now, what about the services running before turning off the device? These services were still draining too much of battery.</p><p>So to overcome this, from <strong>Oreo 8.0 (API 26)</strong>, Google made <strong>startService()</strong> method of Service to throw an <strong>IllegalStateException</strong> if an app targeting Android 8.0 (that is Oreo) tries to use that method in a situation when it isn’t permitted to create background services.</p><p>One way you can still create a background service, that is by showing in a notification that you’re using a background service (but it is not in the scope of this article).</p><p>Developers are extra smart these days. To overcome this they started not targetting API 26(OREO).</p><p>Google had all the resources so they made is necessary from August 2018 for new apps to target API level 26. Still, apps that were already available on the play store could get away. So Google from November 2018 made it necessary for existing apps to target API level 26 or higher to update the already available apps.</p><p>Hence, Google had the last laugh. :)</p><h4>AlarmManager</h4><p>If you want to run a task at every particular interval, for that you can easily go with <strong>AlarmManager( which is present from Android version 1)</strong>. Although significant changes were made in this API from version 19, to save battery of the device and boost the performance, the biggest drawback of Alarm Manager is that it solely works on the basis of time. So in case you want to do some task only when a device is connected to a charger or wifi is turned on etc, then you can’t use AlarmManager.</p><h4>JobScheduler</h4><p><strong>JobScheduler </strong>is there for you. JobScheduler works on various conditions like availability of the network, charging of the device, etc. But now, JobScheduler was introduced in <strong>Lollipop(API 21)</strong> so it doesn&#39;t support the devices below this API level. So if you wanna do all these tasks to perform below API 21, then hard luck. You can’t use JobScheduler.</p><h4><strong>FireBase JobDispatcher</strong></h4><p>Now, if you want to execute these tasks as well as want to have backward compatibility below Lollipop, then you go with <strong>FireBase JobDispatcher</strong> which can be used for all the devices that have <strong>Google play services</strong> installed (API level &gt; 9). It uses <strong>JobScheduler</strong> if the API is above 21 and for API below 21 it <strong>GCMNetworkManager</strong> till API level 7.5 and below it, it uses <strong>AlarmManager</strong>.</p><p>So simply, it uses JobScheduler for API level &gt; 21 and for below levels, it uses Google play services for <strong>9&lt;API level&lt;21</strong>, for <strong>7.5&lt;API level&lt;9</strong>, it uses GCMNetworkManager and below 7.5 level it uses AlarmManager.</p><p><strong>NOTE</strong>: Google Play Service is the advanced version of GCMNetworkManager. You can also say that Google Play Service was formerly known as GCMNetworkManager.</p><p>Now, as you can see with Firebase JobDispatcher, we can cover all the API levels.</p><p>WTF! Why WorkManager then?</p><p>But, Wait. It requires <strong>Google Play Services!!</strong></p><p>Therefore If you are going to use it, you will leave tens of millions of users out all Amazon Fire, Amazon TV and hundreds of Chinese manufacturers(all these devices don’t have Google Play Services).</p><p>Yippieee! At last WorkManager?</p><p>YES!</p><h4>WorkManager</h4><p>So there are different solutions for different device states. Android versions and with/without Google Play Services devices. You probably will start to think that you need to implement all this hard work by yourself and combine different solutions based on “what and how.”.</p><p>That is use <strong>if-else</strong> and use all these already available libraries by checking API levels.</p><p>Isn’t it too boring?</p><p>What is someone provides us the boilerplate to do all this?</p><p>The good thing is that the folks at the Android framework hear all our complaints.</p><p>In <strong>Google, I/O 2018</strong> Android team announced <strong>WorkManager.</strong></p><p>WorkManager aims to simplify the developer experience by providing a first-class API for system-driven background processing. It is intended for background jobs that should run even if the app is no longer in the foreground. Where possible, it uses JobScheduler or Firebase JobDispatcher to do the work; if your app is in the foreground, it will even try to do the work directly in your process.</p><p>This exactly what we need — a simple wrapper for all those crazy background execution options.</p><p>The two features that I am excited about with WorkManager are: being able to <strong>chain work </strong>and the ability to be <strong>opportunistic </strong>on work with constraints. The first will allow work (jobs) to be broken up and more modular for me. And with more modular work, each piece of work may have fewer constraints improving the chance they will complete earlier (opportunistic). For example, the majority of processing work can complete before the work with a network constraint needs to be met.</p><p>Lovely! Here you go. Now you know the historical background of WorkManager.</p><p>It’s always better to learn the historical background before learning something, it makes you a good developer.</p><p>Congratulations.</p><p>***Clap***Clap****Clap****Clap****</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acef9ff07a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guide to the 11 dimensions of Universe]]></title>
            <link>https://medium.com/@wandering.soul/guide-to-the-11-dimensions-of-universe-b64f92a39ce3?source=rss-c4bd05f9dee5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b64f92a39ce3</guid>
            <category><![CDATA[universe]]></category>
            <category><![CDATA[dimensions]]></category>
            <category><![CDATA[physics]]></category>
            <dc:creator><![CDATA[Wandering Soul]]></dc:creator>
            <pubDate>Thu, 13 Jun 2019 05:58:57 GMT</pubDate>
            <atom:updated>2019-06-13T05:58:57.611Z</atom:updated>
            <content:encoded><![CDATA[<p>2-D thinking is when you look an event straight without considering what could have led to the occurrence of that event in the first place. when you only see what you’re offered.</p><p>3-D thinking is being present in this 3-D world and have a sense of the presence of all the <strong>stuff</strong> in this point in time.</p><p>4-D thinking is when you think of any <strong>stuff</strong> going back and forth in time, that is when you start realizing about the past and future of that stuff. So that 3-D plane(that stuff) goes up and down in time in 4-D.</p><p>5-D thinking is when you start thinking about an event that happened back in time or that can happen in future to that <strong>stuff </strong>and you think about all the possibilities that could occur rather than the event that actually happened. So the plane here is the possible occurrence of an event and it goes up and down.</p><p>6-D thinking consists of all the possibilities of all the events that happened with that <strong>stuff</strong> in all time (back and forth). Here the plane is, “all the possibilities of a particular event”. (till now initial and points are the same for that stuff, so whatever possible thing happened with that stuff it all started from the same point (born of a child, bing bang for universe) and lead to the same endpoint (death of the man (same child) or death of the universe).</p><p>7-D thinking is when the initial and end points are not the same. Here the plane is stuff with one specific initial and endpoint.</p><p>8-D thinking is when you have planes of all the <strong>stuff</strong>. Don’t forget, till 7-D we dealt with only one stuff(one person or one universe). 8-D consists plane of all the stuff(all the persons and all the universe). Here the plane is all the possibilities of a particular stuff, so each plane here represents a different stuff. This dimension is a plane of all the possible pasts and futures for each universe, stretching infinitely.</p><p>9-D thinking — Though it seems, we have covered everything possible around. But still, we are left with one possibility. Till now, what we covered had one single initial point and that was the same physical laws. Now this dimension covers the possibilities even when the laws of physics changes. For ex- what if gravity was not the central attractive force, what if the sphere was not the most stable structure possible, what if this and that. All these “what if” becomes a plane in 9-D thinking.</p><p>10-D or 11-D thinking — now Some scientists believe that the multiverse has only 10 dimensions while others put that number at 11.</p><p>However, a universe cannot have more than 11 dimensions because of self-consistency — they become unstable and collapse back down into 11 or 10 dimensions.</p><p>At this point, anything is possible. There are all futures, all pasts, all beginnings and all ends, infinitely extended, a dimension of anything you can imagine. Everything comes together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b64f92a39ce3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Upload your first android library]]></title>
            <link>https://medium.com/@wandering.soul/upload-your-first-android-library-1892c23aea0f?source=rss-c4bd05f9dee5------2</link>
            <guid isPermaLink="false">https://medium.com/p/1892c23aea0f</guid>
            <category><![CDATA[modular]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-libraries]]></category>
            <dc:creator><![CDATA[Wandering Soul]]></dc:creator>
            <pubDate>Fri, 11 May 2018 07:13:08 GMT</pubDate>
            <atom:updated>2018-05-14T15:23:37.781Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*SwoFFpMno07FIoDqvKCucg.jpeg" /></figure><p>This tutorial is for each and every android developer who has been writing codes and making awesome android apps for quite a time and sometime wonder to own their own android libraries. This tutorial is also for the beginners as writing in modules and extracting libraries of something you might find helpful in future, is important.</p><p>I’ll go through all the steps needed to upload your first android library, so just keep your belt tight and hold a cup of coffee .</p><p>Don’t you feel wondering when you add a line of code and suddenly start using a library made by someone sometime in past?So what exactly happens when we add a line of code in build.gradle file and hit sync?Where does Gradle get all the details of the library?Can we make our own library? If YES, then how?</p><p>These are all the question that used to excite me until I had my first library.So in this tutorial we’ll try to get answer of all these question.</p><p>Let’s start…..</p><h3><strong>Where does Android studio fetch the library from?</strong></h3><p>When you open your project level build.gradle file, you find words like Jcenter or MavenCentral written somewhere. The whole library stuff revolves around these two.</p><p>When someone uploads a library, it gets uploaded or saved in a repository called Maven repository. Jcenter and MavenCentral are two Maven repository. You can upload your library in Jcenter’s Maven repository or MavenCentral’s Maven repository, you can even upload it to both. Now, Jcenter is biggest Maven repository with most number of libraries even more than MavenCentral.</p><p>I know the above paragraph could just hit your head, I recommend you to read it once again.</p><p>Now when you add any library in build.gradle file, Gradle first sees whether the library is from Jcenter or MavenCentral. Suppose the library is of Jcenter and your project level build.gradle doesn’t have Jcenter added to it then Gradle will simply throw an error to add it (same for MavenCentral) otherwise it just searches Jcenter and downloads the library from there.</p><h3><strong>How does gradle pull a library from Repository?</strong></h3><p>Now when you see the dependency you add to your build.gradle, it consists of 3 parts…</p><pre>implementation <strong>&#39;com.android.support:appcompat-v7:26.1.0&#39;</strong></pre><p>Here, colon divides it into three parts, first part is GROUP_ID,second part is ARTIFACT_ID and third part is VERSION.</p><p>So here, <strong><em>com.android.support</em> </strong>is<strong> </strong>GROUP_ID<strong>, <em>appcompat-v7 </em></strong>is ARTIFACT_ID and <strong><em>26.1.0 </em></strong>is VERSION.</p><p>GROUP_ID can be seen as a repository name assigned for a particular uploader. ARTIFACT_ID can be seen as a name of the repository for the library itself inside the previous repository. GROUP_ID can be same for many dependencies as same uploader can upload many library. ARTIFACT_ID will be diffirent for each library. Now, VERSION is nothing but the version of a particular library. So when you write a dependency, Gradle first goes to the parent repository (the uploader or the GROUP_ID) then it goes in and finds the library the you have added and downloads it according to the version specifeied.</p><p>I think, now you get a clear picture of how it all works. Now it will be easier for you as well as me to get further.</p><h3><strong>What is Bintary and Sonatype?</strong></h3><p>Bintray is a Hosting website for JCenter, so it hosts all the repository of Jcenter. Simply, you’ll first have to upload your library to Bintray website and there only you can sync it with Jcenter. Similarly, Sonatype is a Hosting website for MavenCentral and same applies here.</p><p>In this tutorial, we’ll only learn about uploading library to Bintray and hence to Jcenter (Anyway Jcenter is the most widely used Moven repository). We’ll anyway cover the MavenCentral part in upcoming tutorials, so don’t forget to follow for future notification.</p><h3><strong>How to upload your library to jcenter?</strong></h3><p>Here we’ll go step by step. We’re not gonna cover here how to make a library, for that I’ll certainly make tutorial in future in detail. For now let’s just focus on the uploading part.</p><p><strong><em>STEP-1</em></strong></p><p>Make your project multi-modular and keep your code that you wanna upload as a library in a separate module.</p><p><strong><em>STEP-2</em></strong></p><p>Go to <a href="https://bintray.com/">bintray</a> and make your account. You can simply signup through github.</p><p><strong><em>STEP-3</em></strong></p><p>You’ll end up seeing a screen like shown below, click on “Add new Repository”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q3UeEA5XbkNu5qj_wlQ4Tg.png" /></figure><p><strong><em>STEP-4</em></strong></p><p>Fill the details of your repository,</p><p><strong>Name </strong>— name of the repository (this is not the name of your library)</p><p><strong>Type</strong> — choose “Maven”</p><p>Click “Create”.</p><p><strong><em>STEP-5</em></strong></p><p>Now you need to create a package, so just click on “Add new Package”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D7oP0KnFPUvATzkyoGDK6A.png" /></figure><p>Enter all the required fields and click “Create Package”</p><p><strong><em>STEP-6</em></strong></p><p>Website will redirect you to Edit Package page. Click at package’s name under Edit Package text to enter package’s details page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gLx6sCybk41WZJloNjeniQ.png" /></figure><p>Done! Now you have your own Maven Repository to which you need to upload your library to.</p><p>Your bintray account registration is done from here you can sync your library to Jcenter. As in this tutorial we’re just focusing on Jcenter and not MavenCentral, so we will not go into details on Sonatype account registration. Don’t worry, we’ll cover it in coming tutorial. To get notified, don’t forget to follow and like this tutorial.</p><p>Now let’s get further…..</p><p>Now we need to come back to our Android Studio project and make it ready to upload the library.</p><p><strong><em>STEP-7</em></strong></p><p>Now open your Android Studio project and open your project level build.gradle and add following dependencies.</p><pre>classpath <strong>&#39;com.jfrog.bintray.gradle:gradle-bintray-plugin:1.5&#39;<br></strong>classpath <strong>&#39;com.github.dcendents:android-maven-gradle-plugin:1.5&#39;</strong></pre><p><strong><em>STEP-8</em></strong></p><p>Now open <strong>local.properties </strong>file and add following..</p><pre><strong>bintray.user</strong>=  YOUR_BINTRAY_USERNAME<strong><br>bintray.apikey</strong>=  YOUR_BINTRAY_API_KEY</pre><p>Here, replace YOUR_BINTRAY_USERNAME with your username at bintray website. And replace YOUR_BINTRAY_API_KEY with the api_key of yours that you can find on the bintray website.</p><h3>How to get api_key?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HV8QvXCmYY4qVQyj0vVZFQ.png" /></figure><p>For getting the api_key, you need to click on the “Edit Profile” button of the spinner that pops up when you click your username at top right of the toolbar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oRmBcjvl2GmfEKLKK62OTw.png" /></figure><p>Above screen comes up when you click the edit button. Among the left menu, click the bottom button that says “API key” , it will lead you to another screen where you can find your api key.</p><p>Now that you have got your api key, you need to replace YOUR_BINTRAY_API_KEY with your api key.</p><p>Here, you might ask, Why are we adding these to local.properties?</p><p>The reason is simple, we don’t want these sensitive to share with anyone. And when we upload our library it is most likely that we are gonna save our project to github as well. Now, .gitignore contains local.properties file and hence it is not shared with the github.</p><p><strong><em>STEP-9</em></strong></p><p>Now you need to open build.gradle of your library. And write following code just below the first plugin line.</p><pre>ext {<br>    bintrayRepo = <strong>&#39;RoundView&#39;    </strong><em>//this is the repository name on the bintray site<br>    </em>bintrayName = <strong>&#39;RoundViewWithCenterText&#39;     </strong><em>//this is the package name on the bintray site, so if this  package already exists then it will take<br>    //that but if it doesnt exist then it will craete the package with the name in the above repository<br><br>    </em>libraryName = <strong>&#39;roundimage&#39;  </strong><em>//libraryname ,artifact must be same as the library module name<br>    </em>artifact = <strong>&#39;roundimage&#39;<br>    </strong>publishedGroupId=<strong>&#39;abhishek.com.roundimage&#39; </strong><em>//Now the library link will be :- (compile &#39;PUBLISH_GROUP_ID:ARTIFACT_ID:PUBLISH_VERSION&#39;)<br>    </em>PUBLISH_GROUP_ID = <strong>&#39;abhishek.com.roundimage&#39;   </strong><em>//SO, (compile &#39;abhishek.com.roundimage:roundimage:1.0.0&#39;)<br>    </em>PUBLISH_ARTIFACT_ID = <strong>&#39;roundimage&#39;<br>    </strong>PUBLISH_VERSION = <strong>&#39;1.0.0&#39;<br>    </strong>libraryVersion=<strong>&#39;1.0.0&#39;<br>    </strong>libraryDescription = <strong>&#39;This provides a round view with a text in the center&#39;<br><br>    </strong>siteUrl = <strong>&#39;https://github.com/abhiint16/RoundImageView&#39;<br>    </strong>gitUrl = <strong>&#39;https://github.com/abhiint16/RoundImageView.git&#39;<br><br>    </strong>developerId = <strong>&#39;abhiint16&#39;<br>    </strong>developerName = <strong>&#39;Abhishek Kumar&#39;<br>    </strong>developerEmail = <strong>&#39;abhishekint16@gmail.com&#39;<br><br>    </strong>licenseName = <strong>&#39;The Apache Software License, Version 2.0&#39;<br>    </strong>licenseUrl = <strong>&#39;http://www.apache.org/licenses/LICENSE-2.0.txt&#39;<br>    </strong>allLicenses = [<strong>&quot;Apache-2.0&quot;</strong>]<br>}</pre><p>Just copy the above code and paste it in your project and it is self explanatory. I’ve written comments beside the lines that are needed to change. You need to replace all my credentials with your credentials.</p><p><strong><em>STEP-10</em></strong></p><p>Your project is almost set. You just need to add below code at the very bottom of library’s build.gradle file.</p><pre>apply <strong>from</strong>: <strong>&#39;https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle&#39;<br></strong><em>// Place it at the end of the file<br></em>apply <strong>from</strong>: <strong>&#39;https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle&#39;<br></strong>apply <strong>from</strong>: <strong>&#39;https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle&#39;</strong></pre><p>Add above code below your dependencies section (Not in dependency but below it).</p><p>Congratulations! Your first library is ready to be uploaded to bintray.</p><p><strong><em>STEP-11</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J6k4qBdGI294PNo9TsK1uQ.png" /></figure><p>In this step we will just upload your library to bintray.</p><p>Open <em>Terminal </em>of Android Studio as shown in the picture above.</p><p>In the Terminal you need to write 2 commands and you’re done.</p><p><strong><em>1st Command</em></strong></p><p>gradlew install</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*MtIedmQSb-WtOQ9-jjAYrg.png" /></figure><p>Now wait for the Successful Build. If everything is fine, your build will be successful. BTW, by this command we’re just packaging our library to upload. This step might take some minute to coomplete, so don’t lose your patience.</p><p><strong><em>2nd Command</em></strong></p><p>gradlew bintrayUpload</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*NeGvEb_djrkwpVGK3qk1TQ.png" /></figure><p>This command uploads your library to Maven Repository.</p><p>You’re done! Just wait for the successful message. If you get one, Congratulations you now have your first library.</p><p><strong><em>STEP-12</em></strong></p><p>Although your library has been uploaded but still it is on Maven Repository only and not yet been uploaded to Jcenter. If you dont upload it to jcenter, other developers can still use your library by writing one extra line.</p><p>For now if other developers want to use your library, they can by adding one extra line to their project level build.gradle file in addition to the dependency they will add to their module’s build.gradle.</p><p>Where to get that extra line from?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eMhHmJZmr5XjDo_IfvAaIA.png" /></figure><p>In above picture, click on blue button that says “SET ME UP”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*FlxO_gdS2DuNeiBvGHWT8w.png" /></figure><p>Now, above screen will come up and you just need to click the highlighted portion and you’ll get the extra-line that you can tell other developers to write in their project level build.gradle file in addition to the dependency they write in their module’s build.gradle file.</p><p><strong><em>STEP-13</em></strong></p><p>Other developers can use your library but this was not that we wanted at the beginning. We wanted other developer to just add one dependency to use your library and not two lines. So we still need to do something.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*z9vf_rumgmviKs_V5qjMcQ.png" /></figure><p>To sync your library to Jcenter, you just need to click on the highlighted button. Another screen will come up, you don’t need to do anything, just click “SEND”.</p><p>Now, nothing that you can do, you just need to wait for some hours(it sometime take one whole day).You’ll get a main from bintray once your library is synced to Jcenter. Once it is done, “Add to Jcenter” will change to something like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*Yk7lWLmcfgQ2CIBBpLS_2A.png" /></figure><p>A very Congratulations from my side. You now have got your library synced to Jcenter. Now any developer can use your library by just adding one-line dependency.</p><p>If you find this article helpful, like , share and don’t forget t follow for future contribution from my side. I’ll come up with some awesome articles in which I’m gonna explain everything in details.</p><p>Thanks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1892c23aea0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>