<?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 Rachit M on Medium]]></title>
        <description><![CDATA[Stories by Rachit M on Medium]]></description>
        <link>https://medium.com/@rachitmishra?source=rss-b1fd694993e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bfTq1100UqZeoOkiEUHcew.jpeg</url>
            <title>Stories by Rachit M on Medium</title>
            <link>https://medium.com/@rachitmishra?source=rss-b1fd694993e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 08:42:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rachitmishra/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[How we did it — Modularising an Android App — Part 2]]></title>
            <link>https://medium.com/@rachitmishra/how-we-did-it-modularising-an-android-app-part-2-86819e98c358?source=rss-b1fd694993e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/86819e98c358</guid>
            <category><![CDATA[modularization]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Rachit M]]></dc:creator>
            <pubDate>Fri, 24 Apr 2020 18:40:09 GMT</pubDate>
            <atom:updated>2020-04-24T18:42:02.273Z</atom:updated>
            <content:encoded><![CDATA[<h3>How we did it — Modularising an Android App — Part 2</h3><h4>Navigation between modules</h4><p>In the first part of this post, we talked about the testing plans, modularization structure and release plans.</p><p>In this post, we will share how we solved the navigation problems and reducing the inter-module dependency for navigation.</p><h4>Navigating between modules</h4><p>If all our activities are part of a single app module, starting a new activity is as simple as</p><p>startActivity(this, A::class)</p><p>Although we do end up increasing the coupling by referring to the class A and this happens across our projects.</p><p>For starting a new screen from a different module we had 2 approaches,</p><ol><li>Each feature module specifies it’s own navigator interface using which other features modules can start the activities of a different module.</li><li>Another approach would be using Intent actions and firing them</li><li>The one we chose was using <a href="https://developer.android.com/training/app-links/">Android app links</a> and why it works better for us is what will share ahead.</li></ol><p>We agreed on the app link url as app://myapp/feature1?key=value&amp;key=value</p><p>The deep link values are part of the base build file.</p><pre>resValue &#39;string&#39;, &#39;app_link_scheme&#39;, &quot;app&quot;<br>resValue &#39;string&#39;, &#39;app_link_host&#39;, &quot;partner&quot;</pre><p>This makes sure we have a single source of truth for all the app link urls, and they urls are available to all the other feature modules through the base module.</p><p>And using Kotlin extension properties they are accessible to each activity as</p><pre>val Context.baseAppLinkUrl: String<br>    get() {<br>        val appScheme = getString(R.string.app_link_scheme)<br>        val appHost = getString(R.string.app_link_host)<br>        return &quot;$appScheme://$appHost&quot;<br>    }</pre><p>Then inside any feature module manifest file we can easily add the deep link intent filter as</p><pre>&lt;intent-filter&gt;<br>    &lt;action android:name=&quot;android.intent.action.VIEW&quot; /&gt;</pre><pre>    &lt;category android:name=&quot;android.intent.category.DEFAULT&quot; /&gt;<br>    &lt;category android:name=&quot;android.intent.category.BROWSABLE&quot; /&gt;</pre><pre>    &lt;data<br>        android:host=&quot;@string/app_link_host&quot;<br>        android:pathPrefix=&quot;/login&quot;<br>        android:scheme=&quot;@string/app_link_scheme&quot; /&gt;<br>&lt;/intent-filter&gt;</pre><p>So this activity can be easily started from any other module/activity using a simple url as</p><pre>val nextIntent = Intent(Intent.<em>ACTION_VIEW, Uri.parse(</em>app://myapp/login)<br>startActivity(nextIntent)</pre><p>and no module/class dependency would be required.</p><p>We also added a helper ApplinkManagerto our base module, which would help us isolate the creation of Intent based on deep-link urls while also making sure that the user was logged.</p><p>The ApplinkManager can also be used to simplify notification deeplinks and reduce coupling.</p><p>We will talk more about sharing data between modules in the next and final post of this series <a href="https://medium.com/@rachitmishra/how-we-did-it-modularising-an-android-app-part-3-6249f1b6f903">Data Sharing between modules</a>.</p><p>Thank you for reading along.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86819e98c358" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we did it — Modularising the Practo Pro Android App — Part 1]]></title>
            <link>https://medium.com/@rachitmishra/how-we-did-it-modularising-the-practo-pro-android-app-part-1-444d1112de81?source=rss-b1fd694993e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/444d1112de81</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[modularization]]></category>
            <dc:creator><![CDATA[Rachit M]]></dc:creator>
            <pubDate>Fri, 24 Apr 2020 18:39:17 GMT</pubDate>
            <atom:updated>2020-04-24T19:38:45.213Z</atom:updated>
            <content:encoded><![CDATA[<h3>How we did it — Modularising the Practo Pro Android App — Part 1</h3><h4>Reducing build times by 60%</h4><p>A very late post about modularization indeed, and hopefully it will help someone on their way on modularization of monoliths and help them reduce their build times.</p><h3>The context</h3><p>2 years back, We started unifying our multiple partner apps into one single app using the best available software engineering principles we had learnt. <br>Practo Pro would be our one single app for all our partner use cases. The features focused on presence management on <a href="http://practo.com/">Practo</a>, practice management, online consultations, leads dashboard for our partners.</p><p>We organised our codebase features in packages in one single monolith app module. And with time as we added more features, we also added more classes, more utils, more libraries, more resources and eventually a lot more minutes to our build times.</p><p>Our initial apps consisting of small feature sets used to compile in around 2–3 mins. The new single app initially compiled with a best case time of 4–5 mins.<br>But as the features grew the build time grew to 8–9 mins for every build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*J-1MC3QGbIuwq4tb-yr-iA.png" /><figcaption>¯\_(ツ)_/¯</figcaption></figure><p>The build time is never a burning issue until we want to build a new feature and the whole Android app has to be rebuilt to run one single test which includes re-compilation, dexing and transformations of classes part of existing features. So while our builds were running we looked for positivities, vis. few small walks to the coffee machine or reading through <a href="https://www.reddit.com/r/androiddev/">/r/androiddev</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eFHyqTG-DNlotfoowD5GBA.png" /><figcaption>Our build time for the app version 10.2.0 release around 3 months back.</figcaption></figure><h3>Improvements and Gradle modules, but why?</h3><p>By using some of the best practices mentioned <a href="https://developer.android.com/studio/build/optimize-your-build">here</a>, we did manage to bring our build times to 6–7 minutes.</p><p>The battle was still half won, to build/create smaller features we had to rebuild the whole app module, and we were also missing on few of the great Gradle features such as <a href="https://docs.gradle.org/current/userguide/multi_project_builds.html#sec:configuration_on_demand">configuration on demand</a> or <a href="https://guides.gradle.org/performance/#parallel_execution">parallel builds</a> for the code base.</p><p>Modules would also help us reduce the coupling between our code with modular boundaries thought around features, while making sure individual teams could effectively focus on lint warnings and test for a single small module rather than the whole app.</p><p>Other big wins would be <a href="https://developer.android.com/studio/projects/dynamic-delivery">dynamic delivery</a> and instant apps.</p><p>And we set out with a primary goal for ourselves to reduce the build times using modularization.</p><p>Now we can easily find multiple really good articles on modularization over medium. So we won’t delve a lot into that. We would rather focus on the best practices we chose and how to incrementally shipped it feature by feature.</p><h3>The plan and the execution</h3><h4>Release plan</h4><p>The release plan was based on breaking and refactoring common code to libraries first and incrementally release first the common modules, and then build the feature modules using these libraries.</p><p>We broke down the release to over 3 months. The first 1.5 months focused on refactoring and shipping out common code shared between features, and the session management code, for the last 1.5 months we focused on shipping the smaller feature modules first ex. lead dashboard, medicine directory which was followed by the considerably chunkier online consultations, profile management and practice management modules.</p><p>We have been adapting to Kotlin, MVVM and Architecture components over past few years and it’s always tempting to re-write the existing code while doing modularization.</p><blockquote>We won’t rewrite anything</blockquote><p>We agreed that we won’t rewrite anything new except the communication layers between modules or any new helper with the sole purpose to ease the modularization flow and our sole focus to use refactoring only to reduce the coupling, rather than rewriting anything new.</p><p>We also made sure we were shipping new features regularly and piggybacking our modularization on top of them so the business requirements were also met.</p><p>A lot of learnings for refactoring the code were borrowed by the <a href="https://martinfowler.com/books/refactoring.html">Refactoring</a> book.</p><h4>Refactoring the code</h4><p>Our first step was to unify all the code spread across activities to the helpers for a use with Single Responsibility in mind.</p><p>All our activities extended from a Base activity and this one activity included code from every feature module. We used <em>extension functions</em> in Kotlin to abstract the common helper implementations from the activities and delegated the feature specific use cases to the feature modules.</p><h4>Powerful tests</h4><p>The first and most important step before starting any refactoring process is to make sure we have a strong set of test suites which include the small units as well as large integration tests.</p><p>Our automation suites were a great win here, while the available unit tests for the few modules also gave us the confidence in the refactoring/modularising process.</p><p>So if your test cases aren’t great it would be little more effort in testing and releasing changes after the refactoring part is done.</p><h4>Smaller and single responsibility modules</h4><p>We started with creating modules on basis of a feature or utility with all of them based on the Single responsibility pattern.</p><p>We also had to make sure that there were zero cyclic dependencies between the modules.<br>With the feature modules dependent on utility modules whenever required.<br>So the modules we ended up creating are — (in the order they were released)</p><ul><li>common-utils — Library module for all utility classes</li><li>common-ui — Library module for all UI/Custom Views</li><li>common-databinding — Library module for data binding adapters and helpers</li><li>common-network — Library module for legacy support for Volley library</li><li>common-support — Library module to create support tickets</li><li>gallery — Library module for capturing and displaying pictures as required by any feature module.</li><li>base — Base feature module containing the helpers for firebase, analytics and other libraries and this would be part of all feature modules.</li><li>accounts — Library module to create and manage the current session state.</li><li>notifications — Library module to manage all the notifications</li><li>model — Library module for all common plain model classes</li><li>consult — Library module for supporting online consultations</li><li>profile — Library module for profile management on practo.com</li><li>practice— Library module for our practice management offering</li></ul><p><em>And the most important one</em></p><ul><li>bridge — Library module containing all the interfaces for inter-module communication and reducing cyclic dependencies. We will talk more about this in the upcoming post.</li></ul><p>We also kept in mind The frequency of changes/usage of a particular helper module. So while we could have easily merged common-databinding, common-network with common-utils. We considered the fact that not all our feature modules will require data binding or the Volley network library, and merging them to utils library will only add more overhead.</p><p>As the common classes ex. helpers for showing a picture or capturing from the camera, notification, utils were specific to particular use cases so they were also moved to individual modules</p><h3>The result</h3><blockquote>Fast forward 3 months, 35 pull requests with changes to around ~50000 loc</blockquote><p>The new incremental build time for our app ~2.5 mins</p><p>That’s not all folks, running tests and or building individuals modules now takes less than 30s.</p><p>We will talk more about handling the navigation and sharing data between modules in next posts</p><p>Part II: <a href="https://medium.com/@rachitmishra/how-we-did-it-modularising-an-android-app-part-2-86819e98c358">Navigation between modules</a>, and Part III: <a href="https://medium.com/@rachitmishra/how-we-did-it-modularising-an-android-app-part-3-6249f1b6f903">Data Sharing between modules.</a></p><p>Thanks and read along with the next posts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=444d1112de81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a lifecycle aware exoplayer based media player component]]></title>
            <link>https://medium.com/android-news/building-a-lifecycle-aware-media-playback-component-with-exoplayer-api-3690c2459109?source=rss-b1fd694993e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/3690c2459109</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[exoplayer]]></category>
            <dc:creator><![CDATA[Rachit M]]></dc:creator>
            <pubDate>Mon, 03 Dec 2018 04:01:00 GMT</pubDate>
            <atom:updated>2018-12-03T04:01:00.753Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<h3>Building a lifecycle aware media playback component with Exoplayer API</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*8_1DWoFSiPhWdSlg5m4J3w.png" /></figure><blockquote>TLDR; We created an easy to use wrapper on top of exoplayer api and made it lifecycle aware. Find the source code <a href="https://github.com/rachitmishra/cocoui">here</a></blockquote><p>For a recent feature, we needed to add audio streaming support to our application.</p><p>Media playback isn’t the most complex topic out there and one can easily start with <a href="https://developer.android.com/guide/topics/media/mediaplayer">Mediaplayer</a> APIs.</p><p>And well for local media files it works really well, except for a few device-specific issues, or when we have to work on managing states (A little complex), also most of the MediaPlayer updates are tied to the OS update.</p><p>The alternative to MediaPlayer is <a href="https://github.com/google/ExoPlayer">Exoplayer</a> a `powerful` media playback library by Google which can be easily customised, ships with our application and can be updated through the play store. Exoplayer also happens to be the defacto suggested library for media playback on Android.</p><p>As with MediaPlayer APIs, Exoplayer also requires a bit of customization and resource clearing once the playback is completed.</p><p>We can build a small life cycle aware component which handles the customization for us as well it manages its own <a href="https://developer.android.com/topic/libraries/architecture/lifecycle">lifecycle</a></p><h3>Creating a life cycle aware component</h3><p>While building the custom view for playback; we decided to make it life cycle aware to initialise or release resources depending on the activity lifecycle.</p><p>We can create a life-cycle aware component with the following steps:</p><ol><li>Add the dependencies</li></ol><pre>implementation &#39;android.arch.lifecycle:extensions:1.1.1&#39;<br>kapt &quot;android.arch.lifecycle:compiler:1.1.1&quot;</pre><p>2. Create a class implementing theLifeCyclerObserver interface with lifecycle as a property. Also, add the current class as lifecycle observer.</p><pre>class PlayerManager(lifecycle: Lifecycle) : LifecycleObserver {<br>...</pre><pre>   init {<br>      lifecycle.addObserver(this) // Adds this class as lifecycle observer<br>   }<br>}</pre><p>3. Add a function annotated with @OnLifecycleEvent which is called once a life event happens.</p><pre>@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)<br>fun onPause() {<br>    if (!hasMarshmallow()) {<br>        releaseMediaPlayer()<br>    }<br>}</pre><p>The annotation @OnLifecycleEvent takes Lifecycle.Event as a parameter and which is an enum specifying the lifecycle states.</p><p>4. Last from our activity or fragment we initialise our helper class as</p><pre>val playerManager = PlayerManager(lifeCycle)</pre><p>Now everytime our activity has paused the onPause function of our PlayerManager class will be called.</p><h3>Welcome <a href="https://github.com/rachitmishra/cocoui">coco-ui</a></h3><p>Coco-ui manages the exoplayer resources by observing activity lifecycle as well as hides the complexity of configuring the Exoplayer. It also gives as LiveData observer to observe media playback events.</p><p>The PlayerManager class mentioned above is part of the library and using the life cycle observer functions it auto clears the exoplayer resources once our activity has paused.</p><p>The other two classes are:</p><p>The MediaPlayerView is a custom view based on PlayerView from the exoplayer library. It holds the configuration objects for the underlying exoplayer implementation.</p><p>and MediaPlayerState containing the enum states possible for media playback</p><pre>enum class MediaPlayerState {<br>    BUFFERING,<br>    READY,<br>    ERROR,<br>    UNKNOWN_MEDIA,<br>    LOW_VOLUME,<br>    COMPLETED<br>}</pre><h3>Using coco-ui in an activity</h3><p>The steps to add the library to your project are</p><p>1st. Add the exoplayer dependencies, and include the library .aar file from the github repo (till we upload it to maven)</p><p>2nd, create the playback layout or use the default layout provided in the library sample.</p><p>3rd, Add the MediaPlayerView to the activity which has to play the media and specify the default configs as per Exoplayer library.</p><pre>&lt;com.rachitmishra.coco.ui.MediaPlayerView<br>    android:id=&quot;@+id/mediaPlayerView&quot;<br>    android:layout_width=&quot;match_parent&quot;<br>    android:layout_height=&quot;wrap_content&quot;<br>    app:auto_show=&quot;true&quot; <br>    app:controller_layout_id=&quot;@layout/layout_playback_controls&quot;<br>    app:hide_on_touch=&quot;false&quot;<br>    app:layout_constraintBottom_toBottomOf=&quot;parent&quot;<br>    app:layout_constraintTop_toBottomOf=&quot;@+id/textView&quot;<br>    app:show_timeout=&quot;0&quot;/&gt;</pre><p>The exoplayer configuration in we are using in above code is</p><pre>app:auto_show=&quot;true&quot; -&gt; Auto show the playback controls<br>app:hide_on_touch=&quot;false&quot; -&gt; Hide playback controls on touch<br>app:show_timeout=&quot;0&quot; -&gt; Hide controls once user has touched it<br>happ:controller_layout_id=&quot;@layout/layout_playback_controls&quot; -&gt; The playback layout</pre><p>For more detailed configuration settings kindly read the Exoplayer docs <a href="https://google.github.io/ExoPlayer/guide.html">here</a></p><p>4th, Initialise the MediaPlayerView from the activity</p><pre>val mediaUrl: String = ...<br>val headers: ArrayMap&lt;String, String&gt; = ...<br>val userAgent: String = ...<br> mediaPlayerView<br>    .headers(headers)<br>    .userAgent(userAgent)<br>    .from(mediaUrl)<br>    .observe(lifecycle) {<br>        mediaPlayerListener(it)<br>    }</pre><pre>fun mediaPlayerListener(state: MediaPlayerState?) {<br>    when (state) {<br>        MediaPlayerState.LOW_VOLUME -&gt;<br>        MediaPlayerState.ERROR -&gt; {<br>        }<br>        MediaPlayerState.BUFFERING -&gt;<br>        MediaPlayerState.READY -&gt; {<br>        }<br>        MediaPlayerState.COMPLETED -&gt;<br>        MediaPlayerState.UNKNOWN_MEDIA -&gt;<br>    }<br> }</pre><p>That’s all folks, 4 steps and now our lifecycle component will auto manage the resources related to exoplayer library while also hiding the complexity of configuring it.</p><p>Few learnings from this projects were</p><ul><li>We shouldn’t use multiple instances of exoplayer API as it requires managing multiple states and become bit complex.</li><li>While adding playback to a list a good practice would be to initialise the playback in a different view above the list rather than adding playback listeners to each list item and the list items should be responsible only for showing the saved progress positions.</li><li>We can store the played positions in the list item models and restore the playback state using these values.</li></ul><p><a href="https://github.com/rachitmishra/cocoui">rachitmishra/cocoui</a></p><p>Thanks for reading this and I hope this helps or inspires you to build your own lifecycle aware components.</p><p>Find more interesting articles on software problems at our <a href="https://medium.com/practo-engineering">Practo Engineering</a> blog.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fupscri.be%2F3e491f%3Fas_embed%3Dtrue&amp;dntp=1&amp;url=https%3A%2F%2Fupscri.be%2F3e491f%2F&amp;image=http%3A%2F%2Fapi.screenshotlayer.com%2Fapi%2Fcapture%3Faccess_key%3Dfe59908dad3baab69ffab249a2224b03%26viewport%3D1024x612%26width%3D1000%26url%3Dhttps%253A%252F%252Fupscri.be%252F3e491f%253Fscreenshot&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=upscri" width="800" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/fedb9f91e907af2468a937c944ed32ab/href">https://medium.com/media/fedb9f91e907af2468a937c944ed32ab/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3690c2459109" width="1" height="1" alt=""><hr><p><a href="https://medium.com/android-news/building-a-lifecycle-aware-media-playback-component-with-exoplayer-api-3690c2459109">Building a lifecycle aware exoplayer based media player component</a> was originally published in <a href="https://medium.com/android-news">AndroidPub</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dependency Injection on Android with Dagger 2 (and Kotlin) — Part 2]]></title>
            <link>https://medium.com/@rachitmishra/dependency-injection-on-android-with-dagger-2-and-kotlin-part-2-460062d53880?source=rss-b1fd694993e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/460062d53880</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[dagger-2]]></category>
            <category><![CDATA[android-architecture]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Rachit M]]></dc:creator>
            <pubDate>Thu, 09 Nov 2017 20:44:09 GMT</pubDate>
            <atom:updated>2017-11-09T20:44:09.249Z</atom:updated>
            <content:encoded><![CDATA[<p>In the first part of the series, we talked about the dagger annotations and how they are useful in our projects.</p><p>In the second part we will look at how we can use Dagger 2 to provide dependencies in our mobile apps.</p><p>Add following lines to app build.gradle file</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e4d6910f364d0c8ea0cdf6ec0be7799/href">https://medium.com/media/3e4d6910f364d0c8ea0cdf6ec0be7799/href</a></iframe><ol><li>The plugin <strong>kotlin-kapt </strong>(Kotlin Annotation Processor) is required for processing the kotlin annotations.</li><li>The first dependency is from dagger required for annotations and other internal functionalities.</li><li>The second dependency is our dagger compiler, which is required to process our dagger based annotations and generate the code.</li><li>The third dependency is for Dagger android annotations.</li><li>The fourth dependency is our dagger android annotation processor.</li><li>The fifth dependency is optional, and it is required when we are working with Support Fragments .</li></ol><p>For Android, the way we provide or create the object graph remain similar. What we improve on is how we inject the requested dependencies.</p><h3>Injecting Dependencies</h3><p>Android dependencies in activities and other framework classes are provided mostly using subcomponents.</p><p>Now, as we saw with our pure Kotlin examples in <a href="https://medium.com/androidtoday/dagger-2-with-kotlin-59d3c2440f4f">Part 1</a> we may easily create our component class and request a computer instance in our activities in following steps.</p><p>Let’s create an application class and instantiate our component inside it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99ad604f1f6c82e3496674ed8e6bff6d/href">https://medium.com/media/99ad604f1f6c82e3496674ed8e6bff6d/href</a></iframe><p>Now we can use this computerComponentin our Activity and inject the dependencies as —</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce9df3445d42704860facbd1adba4429/href">https://medium.com/media/ce9df3445d42704860facbd1adba4429/href</a></iframe><p>But there is a small issue here, <em>A class should never know how it is being injected, </em>But here our Activity manages the injection, which is not so bad, but not so good either.</p><p>And so there is a better approach to this —</p><h3>Android Annotations</h3><p>@ContributesAndroidInjector</p><ul><li>This is the easiest way of injecting dependency in our Activity.</li><li>It is good to have custom scope for our provider function annotated with this @ContributesAndroidInjector for performance benefits discussed earlier.</li></ul><h4>Injecting Activities</h4><p>Let’s take another example of injecting an activity ex.HomeActivity with HomeViewModel .</p><p>Given we have,HomeViewModel with a constructor with @Inject annotation to request the additional dependencies required to create it’s instance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a3980aceac79399a79a67815926e142/href">https://medium.com/media/1a3980aceac79399a79a67815926e142/href</a></iframe><p>We declare the activity binding using the annotation @ContributesAndroidInjector inside our ActivityBindings module.<br>Notice the provider is annotated with @ActivityScope custom scope.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/59f0c4a9a0b6dd3c6f6204ce93a51f61/href">https://medium.com/media/59f0c4a9a0b6dd3c6f6204ce93a51f61/href</a></iframe><p>Next we declare our application class as</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ce1717dcd40c63a1036b87c0391cf6b/href">https://medium.com/media/5ce1717dcd40c63a1036b87c0391cf6b/href</a></iframe><p>Our application class needs to implement the HasActivityInjector interface and provide a DispatchingAndroidInjector&lt;Activity&gt; for injecting dependencies inside our Activity.</p><p>The DispatchingAndroidInjector is again injected <em>magically</em> using Dagger.</p><p>We request dependencies in our Activity as</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a15e71aad8ac7247134aa0ec17ef3ae9/href">https://medium.com/media/a15e71aad8ac7247134aa0ec17ef3ae9/href</a></iframe><ul><li>The activity has to call AndroidInjection.inject(this) before the call to super so that dependencies are initialised before fragment attachments.</li><li>In the above code block our HomeActivity requests HomeViewModel to be injected. AndroidInjection.inject(this) requests the injectable dependencies from the Application class, which in turn using DispatchingAndroidInjector binds our dependencies to our activity.</li></ul><h4>Injecting Fragments</h4><p>In a similar way we can also inject fragments with our dependencies in following steps.</p><p>Our activity hosting the fragment has to implement the HasFragmentInjector and provide an instance of DispatchingAndroidInjector<strong>&lt;</strong>Fragment<strong>&gt;</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/54b48c4eda2b7920df958942ea12c200/href">https://medium.com/media/54b48c4eda2b7920df958942ea12c200/href</a></iframe><p>In our fragment, we request the dependency in the onAttach function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8aa66a0b32d4599fbad05ec38f7099be/href">https://medium.com/media/8aa66a0b32d4599fbad05ec38f7099be/href</a></iframe><pre>Declaring activity subcomponents to provide dependencies</pre><p>If you have a complex set of dependencies, the other way to provide dependencies is using subcomponents for our activities/fragments. I won’t go in much detail of that. Although you may read more about it <a href="https://google.github.io/dagger/android.html">here</a>.</p><p><strong>Sample Project</strong></p><p><a href="https://github.com/rachitmishra/define">rachitmishra/define</a></p><h3>Issues faced</h3><p><strong>Dagger code was not being generated</strong><br>- I was using annotationProcessor in place of `kapt`<br>- One of my projects was failing due to a missing import and the IDE wasn’t showing an error.<br>- I had a cyclic dependency.</p><p><strong>NPE exception while using Android Injector</strong><br>The android annotation processor was missing</p><h3>Tips</h3><ol><li>You shouldn’t instantiate objects in your classes rather pass them as dependencies.</li><li>If the IDE isn’t working for you, Try using the command-line.</li><li>Objects which request dependencies; can be easily tested using mocking. It is good to limit our constructor arguments to mockable types.</li></ol><p>There is a lot more in Dagger 2 ex. Multibindings, Lazy injections, Provider injections etc. which we will leave for reader exploration :)</p><p>Follow the <a href="https://gist.github.com/rachitmishra/627ba14d59a60075c98b28338c5664e9">gist</a> for the reference sources.</p><p>That’s all folks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=460062d53880" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile Engineer Checklist (Android)]]></title>
            <link>https://medium.com/@rachitmishra/mobile-engineer-checklist-android-e84470892d8?source=rss-b1fd694993e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e84470892d8</guid>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Rachit M]]></dc:creator>
            <pubDate>Sun, 05 Nov 2017 18:21:26 GMT</pubDate>
            <atom:updated>2017-11-06T19:29:24.072Z</atom:updated>
            <content:encoded><![CDATA[<ul><li><strong>Architecture<br>[ ] </strong>Object oriented Programming<br><strong>[ ]</strong> SOLID Principles<br><strong>[ ]</strong> Common Design Patterns<br><strong>[ ]</strong> Functional programming<br><strong>[ ] </strong>Working with pure functions and immutable data<br><strong>[ ] </strong>Dependency Injection, and Inversion of control<br><strong>[ ] </strong>Architectural components<br><strong>[ ] </strong>Common architectures as MVP, MVVM<br><strong>[ ]</strong> Reactive Programming</li><li><strong>Languages</strong><br><strong>[ ] </strong>Java<br><strong>[ ]</strong> Kotlin<br><strong>[ ] </strong><em>Read Effective Java, and Kotlin in Action</em></li><li><strong>Generating Code</strong><br><strong>[ ] </strong>Annotation processing and generating code on fly.</li><li><strong>Animations<br>[ ] </strong>Physics based animations<br><strong>[ ]</strong> Activity and fragments animations<br><strong>[ ] </strong>Vector animations</li><li><strong>Performance<br>[ ] </strong>Constraint Layout<br><strong>[ ] </strong>Memory profiling<br><strong>[ ] </strong>Vector drawables</li><li><strong>Testing<br>[ ] </strong>Unit testing, Integration testing<strong><br>[ ] </strong>TDD<strong><br>[ ] </strong>BDD<strong><br>[ ] </strong>UI testing with Espresso<strong><br>[ ] </strong>Unit testing with Spec<strong><br>[ ] </strong>Unit testing with Mockito<strong><br>[ ] </strong>Fluent assertions</li><li><strong>Libraries<br>[ ] </strong><a href="https://github.com/ReactiveX/RxJava">RxJava 2</a><br><strong>[ ]</strong> <a href="https://google.github.io/dagger/">Dagger 2</a><br><strong>[ ] </strong><a href="https://github.com/square/retrofit">Retrofit</a><br><strong>[ ] </strong><a href="https://github.com/bumptech/glide">Glide</a><br><strong>[ ] </strong><a href="https://github.com/Kotlin/kotlin-coroutines">Kotlin coroutines</a><br><strong>[ ] </strong><a href="https://developer.android.com/topic/libraries/data-binding/index.html">Android databinding</a><br><strong>[ ] </strong><a href="https://jakewharton.github.io/butterknife/">ButterKnife</a><br><strong>[ ] </strong><a href="https://github.com/square/okhttp">OkHttp</a> <br><strong>[ ]</strong><a href="http://junit.org/junit5/"><strong> </strong>JUnit</a><br><strong>[ ]</strong> <a href="https://github.com/google/truth">Google Truth</a><br><strong>[ ]</strong> <a href="https://github.com/mockito/mockito">Mockito</a><br><strong>[ ]</strong> <a href="https://developer.android.com/training/testing/espresso/index.html">Espresso</a><br><strong>[ ] </strong><a href="https://github.com/square/kotlinpoet">KotlinPoet</a><br><strong>[ ]</strong> <a href="https://developer.android.com/topic/libraries/architecture/index.html">Architecture components</a><br><strong>[ ] </strong><a href="https://github.com/googlesamples/android-architecture">Android Architecture Samples</a><br><strong>[ ]</strong> Firebase</li><li><strong>Security<br>[ ] </strong><a href="https://developer.android.com/training/articles/security-tips.html">Android Security Tips</a></li></ul><p>Last, you should watch once</p><p><a href="https://www.microsoft.com/en-us/research/project/tuva-richard-feynman/">Project Tuva: Richard Feynman&#39;s Messenger Lecture Series - Microsoft Research</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e84470892d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dependency Injection on Android with Dagger 2 (and Kotlin) — Part 1]]></title>
            <link>https://medium.com/@rachitmishra/dagger-2-with-kotlin-59d3c2440f4f?source=rss-b1fd694993e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/59d3c2440f4f</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[android-architecture]]></category>
            <category><![CDATA[dagger-2]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Rachit M]]></dc:creator>
            <pubDate>Sun, 05 Nov 2017 17:45:57 GMT</pubDate>
            <atom:updated>2018-10-28T20:58:39.091Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OkYw5mjree9NEVEPbTeX2g.jpeg" /></figure><blockquote>Dependency injection means giving an object its instance variables — James Shore</blockquote><p>To sum up what it is</p><ul><li>Providing dependencies to classes instead of class itself creating dependencies</li><li>A central/structured way of providing dependent objects/services.</li><li>Helps in Unit testing</li><li>Helps in writing reusable-modular-interchangeable code.</li></ul><p>If you want to read more about DI, Follow the <a href="http://www.jamesshore.com/Blog/Dependency-Injection-Demystified.html">link</a></p><p><strong>Dagger 2:</strong> Is the library which helps us in managing and providing dependencies for our app in a very efficient way. It builds an object graph of dependencies and creates/provides dependencies wherever they are required in the Object graph.</p><h3>Setup</h3><p>We will use <a href="https://www.jetbrains.com/idea/download/">IntelliJ CE</a> with a gradle based project.</p><p>Add following lines to build.gradle</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6ca4dee8016f06acf4098b421db2d298/href">https://medium.com/media/6ca4dee8016f06acf4098b421db2d298/href</a></iframe><ol><li>The plugin <strong>kotlin-kapt </strong>(Kotlin Annotation Processor) is required for processing the kotlin annotations.</li><li>The second dependency is the dagger library required for annotations and other internal functionalities.</li><li>The third dependency is our dagger compiler, which is required to process our dagger based annotations and generate the code.</li></ol><h3>Dagger(2) — The Annotations</h3><p>Dagger can <em>magically</em> create instances of dependencies and use them in the object graph where required. Still, there are scenarios, where we need to instruct/help the library in creating the dependencies, and this is where the annotations come helpful. Let’s read more about them.</p><h3>Providing dependencies</h3><p>@Module</p><ul><li>It is applied to classes/abstract classes.</li><li>It supplies/contributes objects to the dagger object graph.</li><li>It can have dependencies on other modules.</li><li>It contains functions annotated with @Provides.</li><li>A Kotlin class annotated with @Module may contain a companion object for static functions. Don’t forget to annotate the companion object with @Module too.</li><li>Thus a module can be written as following —</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ecc4fd71772d06efc99ad4a72a803d1c/href">https://medium.com/media/ecc4fd71772d06efc99ad4a72a803d1c/href</a></iframe><ul><li>In the above code-block we have declared a computer module, which provides the additional dependencies for creating a computer. We also have @Namedfunction for providing graphics ram as the module provides two different types of graphics ram.</li><li>Also, We declare our power supply provider function in a companion object for direct access.</li><li>This way of declaring static functions using companion objects has a small drawback. An extra class for the companion object will be generated by the dagger.</li></ul><p>@Provides</p><ul><li>It is applied to functions</li><li>It creates/specifies how objects will be provided by the module.</li><li>It should be used to provide complex or external dependencies.</li><li>For further reference let’s call these functions <em>provider functions</em></li></ul><p><strong>static</strong> @Provides</p><ul><li>Everytime to provide a dependency, an instance of our module has to be created. A lot of modules = A lot of instances = A lot more time and performance hit!</li><li>Using static provider functions to provide dependencies, we get better performance, as an instance of module is not required to access this function.</li><li>In Kotlin, we declare functions inside companion object of the class to make them static and annotate the function with @JvmStatic for instance-less access.</li></ul><p>@Component</p><ul><li>It is applied to interfaces</li><li>It specifies all the modules available, and thus also acts as a central provider/factory for dependencies</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8c4b92e3d477ac9b3dccfdbc6d07c3f/href">https://medium.com/media/b8c4b92e3d477ac9b3dccfdbc6d07c3f/href</a></iframe><ul><li>The above code block contains the implementation of our Computer component, which depends on Computer module, and contains a provision function getComputer()</li></ul><p>@Named</p><ul><li>It is a qualifier annotation provided by dagger.</li><li>It is applied to functions.</li><li>It is helpful when we are creating dependencies of the same type, or when our provider functions return same type object.</li><li>Ex. In ComputerModule.kt above, we have two functions which return VideoRam so we annotate one function with @Named(&quot;large&quot;) which can be requested using the same named annotation as you can see in providesMotherBoardWithLargeVideoRam function arguments.</li><li>We may also create custom qualified annotations —</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a99c98ef498d140f42399f272189eb35/href">https://medium.com/media/a99c98ef498d140f42399f272189eb35/href</a></iframe><p>@Binds</p><ul><li>It is applied to abstract functions.</li><li>It is used to create/provide concrete implementations of interfaces(contracts/presenters).</li><li>Functions annotated with @Binds and @Provides can’t be part of same class(read module), unless it is static @Provides functions.</li><li>In case of static functions with @Provides, function annotated with @Binds can be part of the same module.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7180fe6ed2d194fd00fe081381705dd1/href">https://medium.com/media/7180fe6ed2d194fd00fe081381705dd1/href</a></iframe><h3>Injecting/Requesting Dependencies</h3><p>@Inject</p><ul><li>We can mark fields or constructors with @Inject, so dagger can <em>magically</em> create and inject the field or type.</li><li>When marking a field with @Inject dagger will create an instance of the type of field and initialize our field.</li><li>In Kotlin, the @Inject field has to be public and late initialized with lateinit var.</li><li>Classes/Types with no-arg constructors will be created by dagger, but in case the class/type depends on other class we need to mark our constructor with @Inject, and dagger will figure out the dependencies, and provide the instance of our type wherever required.</li></ul><h4>Wiring it all together —</h4><p>So, How do we provide all these dependencies to our objects?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82db225a24fc899f841e2b30e61d36c5/href">https://medium.com/media/82db225a24fc899f841e2b30e61d36c5/href</a></iframe><ul><li>In our main function, we call DaggerComputerComponent.builder().build() to get an instance of our component class. Note we named our component class ComputerComponent, Dagger generate a new class after building the object graph, by prefixing our class with Dagger</li><li>The DaggerComputerComponent is generated by a dagger and contains builder functions to initialize modules which can’t be <em>magically </em>created by dagger. Ex. In code above ComputerModule can’t be instantiated as it requires memorySize and vMemorySize as inputs. So it can be set using a builder function of DaggerComputerComponent</li><li>Since our component class had a provision function getComputer, using it we can directly get an instance of the computer class.</li><li>Also, The ComputerApp class requests field injection using @Inject which will also be <em>magically </em>provided by dagger and will be available at runtime.</li></ul><h3>Scopes</h3><p>A scope defines how long our dependency instances will live.</p><p>@Singleton</p><ul><li>Singleton as the name implies, the instance of dependency remains same for the lifecycle of the application, and everyone who requests the dependency will get the same instance.</li><li>It is used if we want an object to live for the application lifecycle. Ex. some auth helper containing auth token, or networking library instance.</li><li>We shouldn’t have a lot of application singletons, as creating higher number dependency instances might slow our application, as well as the longer the dependency instance lives, the higher memory footprint it puts on our application.</li></ul><p>@Reusable</p><ul><li>It is applied to provider function where we want our dependency instances to be reused between components, but at the same time they should be easily available for garbage collection.</li><li>Or, when you wish to tell dagger that it may create a new instance of dependency, but at the same time, it is allowed to use an already existing one.</li><li>The dependencies with @Reusable annotation live as long as the outer component lives.</li><li>The subcomponents may cache the reusable dependencies from parent components.</li></ul><h4>Custom scopes</h4><ul><li>Custom scopes are a great way to manage our dependencies instance.</li><li>By default, If we don’t specify any scopes, everyone who requests an instance of our dependency, will get a new instance. That’s not so good for mobile platforms.</li><li>Custom scopes are to be bound with component lifecycles, and all provided dependencies for that particular scope, live as long as component scope lives.</li><li>If we scope our dependencies, we can limit the number of instances. Ex. for each feature component in our application we may have a different custom scope.</li></ul><h3>Reusing dependencies</h3><h4><strong>Module dependencies</strong></h4><ul><li>A module may depend on other modules. Ex. App module depending on WebService module or Database module.</li><li>It’s good to split dependencies into smaller modules and use them with custom scopes. This leads to significant performance improvements.</li><li>@Module(<strong>includes=arrayOf(SomeOtherModule::class)</strong>) A module annotation may specify dependency on any other module using includes element. Don’t forget to annotate the other class too with @Module.</li></ul><p>@SubComponent</p><ul><li>Subcomponents are the easiest way of accessing dependencies from one component(parent component) to another.</li><li>Subcomponents help us in creating small subgraphs of our application object graph. This helps in limiting the scope of dependencies as well as performance when proving the dependencies.</li><li>Similar to @Component we declare the subcomponents as</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e56b35f5719090e58261bd7abb07a584/href">https://medium.com/media/e56b35f5719090e58261bd7abb07a584/href</a></iframe><ul><li>Subcomponents are tightly coupled with their parent components and they automatically inherit all the dependencies from the parent components.</li><li>We add a subcomponent to parent component by specifying the subcomponent element of any module in our parent component.<br>It is good to keep/specify the subcomponent in relatable modules.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db3e7698b2a6d50eabef549fba226108/href">https://medium.com/media/db3e7698b2a6d50eabef549fba226108/href</a></iframe><ul><li>Subcomponents help us in the better encapsulation of our codebase/between various modules or features of our app.</li><li>Subcomponents aren’t allowed to have the same scope as their parent components.</li></ul><h4>Component dependencies</h4><ul><li>Another way to reuse our dependencies is using component dependency.</li><li>Our component can depend on other components by using the dependency element of @Component annotation.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb3bc7f7215b71846a319c221bc4f193/href">https://medium.com/media/eb3bc7f7215b71846a319c221bc4f193/href</a></iframe><ul><li>In case of component dependencies only public dependencies which are provided by the BaseComponent provision functions are accessible to the dependent component. Ex. in above code block MiningRigComponent has a dependency on ComputerComponent, and it will have to only Computer dependency.</li><li>In comparison, The Subcomponent inherits all the dependencies from the parent.</li></ul><p><em>More to explore/study, Map Multibinding, Async/Lazy provider functions.</em></p><p><strong>Sample project</strong></p><p><a href="https://github.com/rachitmishra/kotlin">rachitmishra/kotlin</a></p><p>That’s all folks. We continue with Dagger in Android in <a href="https://medium.com/@rachitmishra/dependency-injection-on-android-with-dagger-2-and-kotlin-part-2-460062d53880">Part 2</a> of the series</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59d3c2440f4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Invalid vector drawable — Fixing .1 to 0.1]]></title>
            <link>https://medium.com/@rachitmishra/invalid-vector-drawable-fixing-1-to-0-1-1b430d7469e7?source=rss-b1fd694993e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b430d7469e7</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Rachit M]]></dc:creator>
            <pubDate>Fri, 27 Oct 2017 13:42:26 GMT</pubDate>
            <atom:updated>2017-10-27T13:42:26.933Z</atom:updated>
            <content:encoded><![CDATA[<p>So if your vector drawable has a lot of decimal point instructions without the leading 0. You will get a lint error as</p><pre>This check ensures that vector paths are valid. For example, it makes sure that the numbers are not using scientific notation (such as 1.0e3) which can lead to runtime crashes on older devices.</pre><p>I wrote a small python script to fix this in our project</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bdb0a75955a61e6091ff8da1ceb2c745/href">https://medium.com/media/bdb0a75955a61e6091ff8da1ceb2c745/href</a></iframe><p>Also checkout</p><ul><li><a href="https://android.jlelse.eu/how-to-beat-use-0-094-instead-of-094-in-vector-drawable-ef74b68f0ab7">How to beat ‘Use 0.094 instead of .094…’ in vector drawable</a></li><li><a href="https://plugins.jetbrains.com/plugin/9937-dr-vector-android">Dr.Vector Android :: JetBrains Plugin Repository</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b430d7469e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Few helpful IntelliJ shortcuts]]></title>
            <link>https://medium.com/@rachitmishra/few-helpful-intellij-shortcuts-698ea628af7a?source=rss-b1fd694993e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/698ea628af7a</guid>
            <category><![CDATA[intellij]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Rachit M]]></dc:creator>
            <pubDate>Tue, 24 Oct 2017 08:44:34 GMT</pubDate>
            <atom:updated>2017-10-30T13:29:47.590Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<p>Some of the IntelliJ shortcuts I use actively</p><p>cmd + ctrl + a — Open command panel</p><p>cmd + [ — Move back</p><p>cmd + ] — Move forward</p><p>cmd + shift + e — Show recently edit files</p><p>cmd + ctrl + g — Select all occurrences</p><p>cmd + 1 — Open project panel</p><p>cmd + shift + v — Show clipboard history</p><p>cmd + p — Show method parameters</p><p>cmd + shift + u — Change letter case</p><p>cmd + b — Go to implementation</p><p>cmd + option+ b — See all implementations</p><p>cmd + u — Super method</p><p>cmd + j — Insert template</p><p>cmd + o— Open class</p><p>cmd + shift+ o — Open file</p><p>cmd + option+ o — Open symbol</p><p>shift + shift— Open symbol</p><p>cmd + d— Duplicate line or selection</p><p>alt + up/down — Incremental block selection</p><p>ctrl + t— Refactor</p><p>ctrl + shift + space— Smart complete</p><p>cmd + + — Expand</p><p>cmd + - — Collapse</p><p>option + enter — Show intentions</p><p>ctrl + r — Run app</p><p>ctrl + shift + r — Re run app</p><p>ctrl + d — Run debugger</p><p>ctrl + cmd + z — Attach debugger (Added by me)</p><p>cmd + f9 — Build project</p><p>ctrl + shift + x— Clean project(Added by me)</p><p>cmd + shift + f12 — Hide all panels</p><p><strong>A plugin to help you remember all of them</strong></p><p><a href="https://plugins.jetbrains.com/plugin/8357-force-shortcuts">Force Shortcuts :: JetBrains Plugin Repository</a></p><p>A plugin to learn more about IDE</p><p><a href="https://plugins.jetbrains.com/plugin/8554-ide-features-trainer">IDE Features Trainer :: JetBrains Plugin Repository</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=698ea628af7a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin + Multidex + Java and the NoClassDef found error?]]></title>
            <link>https://medium.com/@rachitmishra/kotlin-multidex-java-and-the-noclassdef-found-error-8635dd1f5e90?source=rss-b1fd694993e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8635dd1f5e90</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Rachit M]]></dc:creator>
            <pubDate>Sat, 07 Oct 2017 21:53:00 GMT</pubDate>
            <atom:updated>2017-10-07T21:54:10.191Z</atom:updated>
            <content:encoded><![CDATA[<p>After Kotlin was made official by Google in the IO, we went ahead and gave it a shot for our Android app.</p><p><strong>Pre:</strong> Our app is written in Java and uses Multidex.</p><p>So we decided to migrate one of our modules to Kotlin. Since existing modules are in Java, we had to call some part of the existing code.</p><p>Now, There happens to be this one class with a nested interface. The interface was never declared private.</p><p>We were calling this interface from our Kotlin code using SAM conversions.</p><p><strong>Result: </strong>Our app crashed again and again with NoClassDefFound for MyClass$1</p><p>So, MyClass$1 was the anonymous inner class from SAM conversion, but for some reason it was not being loaded to primary dex file.</p><p>After a small digging we figured out the nested interface in Java was the culprit. And it seems the easy solution was to move the inner interface out of the class.</p><p>Next: Explore why the interface was never loaded to primary dex file at all.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8635dd1f5e90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android developer resources]]></title>
            <link>https://medium.com/@rachitmishra/my-android-way-7d9ddaec18ea?source=rss-b1fd694993e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d9ddaec18ea</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[material-design]]></category>
            <dc:creator><![CDATA[Rachit M]]></dc:creator>
            <pubDate>Sat, 08 Aug 2015 12:23:19 GMT</pubDate>
            <atom:updated>2015-08-08T15:25:53.425Z</atom:updated>
            <content:encoded><![CDATA[<p>Everyone has a set of resource to which we refer while making an application.</p><p>Here are few I use frequently</p><p><a href="https://www.google.com/design/spec/material-design/introduction.html">Introduction - Material design - Material design guidelines</a></p><p>Material design guidelines help in finding the right specs and color combination. Best for developers who are just starting up and need design helps.</p><p><a href="http://romannurik.github.io/AndroidAssetStudio/">Android Asset Studio</a></p><p>The asset studio by @romannurik is the best way to generate icons/drawables for my projects.</p><p><a href="http://materialdesignicons.com/">Material Design Icons</a></p><p>Need more material design icons here is an awesome website with many free material design icons.</p><p><a href="https://android-arsenal.com/">A categorized directory of libraries and tools for Android | Android-Arsenal.com</a></p><p>Looking for any library, well Android Arsenal has a lot of them.</p><p><a href="https://github.com/trending?l=java">Build software better, together</a></p><p>Still looking for more newest, os libraries, well @github is the way to go.</p><p><a href="https://www.materialpalette.com/blue/pink">Material Palette - Material Design Color Palette Generator</a></p><p>Useful for material inspired color palettes.</p><p><a href="http://developer.android.com/guide/index.html">Introduction to Android</a></p><p>The detail guide to almost everything in Android.</p><p><a href="https://stackoverflow.com/">Newest Questions</a></p><p>Have any doubt, or want to learn more <a href="https://stackoverflow.com/questions/popular/android?show=today&amp;sort=hot"><em>https://stackoverflow.com/questions/popular/android?show=today&amp;sort=hot</em></a></p><p><a href="https://fabric.io/">Fabric - App Development Platform for teams</a></p><p>Crashes or bugs, Fabric @twitter is the way.</p><p>These are the some most helpful tools, for my everyday development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d9ddaec18ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>