<?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 Ch Nouman on Medium]]></title>
        <description><![CDATA[Stories by Ch Nouman on Medium]]></description>
        <link>https://medium.com/@ChNouman200?source=rss-d597486ea9e9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LhFeFn5N2grrmMPXD43WCQ.jpeg</url>
            <title>Stories by Ch Nouman on Medium</title>
            <link>https://medium.com/@ChNouman200?source=rss-d597486ea9e9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 02:35:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ChNouman200/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[Quick Things About Android Proguard]]></title>
            <link>https://medium.com/@ChNouman200/quick-things-about-android-proguard-b420f93b8d59?source=rss-d597486ea9e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/b420f93b8d59</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[obfuscation]]></category>
            <category><![CDATA[proguard]]></category>
            <category><![CDATA[android-studio]]></category>
            <category><![CDATA[android-proguard]]></category>
            <dc:creator><![CDATA[Ch Nouman]]></dc:creator>
            <pubDate>Mon, 21 Oct 2019 17:23:15 GMT</pubDate>
            <atom:updated>2019-10-22T06:14:21.646Z</atom:updated>
            <content:encoded><![CDATA[<h3>Things About Android Proguard</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0HxJqv-Jih0UrV2EqmXXXw.jpeg" /><figcaption>Obfuscation in Android using Proguard</figcaption></figure><p><strong>What is Proguard and it’s purpose?</strong></p><p>In simple words, it is an android tool that can serve three purposes for us.</p><ul><li>Minify the Code</li><li>Obfuscate the Code</li><li>Optimize the Code</li></ul><blockquote><strong>Minify the Code</strong></blockquote><p>In minification, Proguard minimizes the code by removing comments, unused classes, etc.</p><blockquote><strong>Obfuscating the Code</strong></blockquote><p>In obfuscation, Proguard converts package names, classes names and class field names to meaningless names. Like class name User can be called a or b.</p><p>The same goes for package names and class fields.</p><blockquote><strong>Optimize the Code</strong></blockquote><p>In optimization, Proguard can do some optimizations on your project like simplify the redundant looping and stuff like this.</p><p><strong>Benefits of Using Proguard:</strong></p><ul><li>Code Protection</li><li>Apk size-reduction</li></ul><p>That’s all.</p><h4>How can I enable or disable this?</h4><p>In build.gradle file add this:</p><pre>release {</pre><pre>   minifyEnabled true</pre><pre>   proguardFiles getDefaultProguardFile(&#39;proguard-android.txt&#39;),    &#39;proguard-rules.pro&#39;</pre><pre>}</pre><p>minifyEnabled true will enable Proguard. All your proguard rules will be in the proguard-android file.</p><p><strong>Here is a list of things that we need to take care of while using Android Proguard</strong></p><p>There are total things right now that we need to take care of. If you found any other feel free to add it to responses below.</p><blockquote>Data/Models and Entity Classes Obfuscation</blockquote><p>What happens with Model/data classes is they get obfuscated and when the response comes from the server or Firebase it doesn’t get parsed correctly and we get the errors. To avoid this we need to keep the model classes from obfuscation.</p><p>Example:</p><pre>-keep class com.company.myfeature.model.** { *; }</pre><p>Another better way to keep any class from obfuscation is to use @Keep annotation from the support library.</p><blockquote>Fragment.class.getSimpleName() Obfuscation</blockquote><p>We should not use Fragment.class.getSimpleName as a TAG for Fragment while playing with FragmentTransactions i.e commit, add etc. If you do this it will throw ClassNotFound exception.</p><p>What we can do for this is always use Static String for Fragment TAGs.</p><blockquote>Reflections Obfuscation</blockquote><p>What happens with reflections when we obfuscate the code it throws exception MethodNotFound. The reason is simple we use static string for the class name and package name but when Proguard works it convert the class name and method names and the app doesn’t find anything matching.</p><p>We can avoid this by keeping Utility classes to avoid issues.</p><p>Example:</p><pre>-keep public class com.medium.utils.*</pre><blockquote>CustomView Obfuscation</blockquote><p>Make sure our custom view is not obfuscated. What happens in custom view is we use them in our layout file i.e &lt;com.medium.CustomImageView/&gt; What will happen is the app will not found any class with this name and app crashes. What we can do is tell proguard to not obfuscate any class which is extending View or ViewGroup.</p><p>here is an example of this.</p><pre>-keep public class * extends android.view.View {<br>        public &lt;init&gt;(android.content.Context);<br>        public &lt;init&gt;(android.content.Context, android.util.AttributeSet);<br>        public &lt;init&gt;(android.content.Context, android.util.AttributeSet, int);<br>        public void set*(...);<br>    }</pre><blockquote>Native JNI Library</blockquote><p>Where ever we are using JNI native method please take care of it. We can do this by telling Proguard that doesn’t obfuscate code where we are using native keyword. JNI takes method name as a string so it will get obfuscated and JNI will give exception MethodNotFound.</p><p>we can do this by using:</p><pre>keepclasseswithmembernames class * { native &lt;methods&gt;; }</pre><p>That’s all for now.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b420f93b8d59" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clean Up Android Code]]></title>
            <link>https://medium.com/@ChNouman200/clean-up-android-code-ef4b2476bf1a?source=rss-d597486ea9e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef4b2476bf1a</guid>
            <dc:creator><![CDATA[Ch Nouman]]></dc:creator>
            <pubDate>Mon, 09 Jul 2018 10:48:49 GMT</pubDate>
            <atom:updated>2018-07-09T10:48:49.827Z</atom:updated>
            <content:encoded><![CDATA[<p>Today i like to write something about writing clean code. Commonly at the start we don’t care how our code looks like but when you grow up with the coding you start worrying about the cleaning of code. This may be because if code is not clean we write the same things again and again in each Activity and Fragment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef4b2476bf1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey To Android Development]]></title>
            <link>https://medium.com/@ChNouman200/my-journey-to-android-development-a20d294fd201?source=rss-d597486ea9e9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a20d294fd201</guid>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[grooming]]></category>
            <category><![CDATA[developer-stories]]></category>
            <dc:creator><![CDATA[Ch Nouman]]></dc:creator>
            <pubDate>Mon, 09 Jul 2018 08:28:40 GMT</pubDate>
            <atom:updated>2018-07-09T10:28:41.921Z</atom:updated>
            <content:encoded><![CDATA[<p>My Journey To Android Development</p><p>It was may 2018 and i was just to complete my graduation from University Of Sargodha. Fear of losing each other was just on the heads of all of us but we have to achieve our best.</p><p>My Previous boss was literally happy with me but company was going to shut off from next month.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a20d294fd201" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>