

{"id":78324,"date":"2020-06-02T10:00:15","date_gmt":"2020-06-02T04:30:15","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=78324"},"modified":"2021-08-25T13:55:00","modified_gmt":"2021-08-25T08:25:00","slug":"android-proguard","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/android-proguard\/","title":{"rendered":"Android Proguard Tool &#8211; How to Enable Proguard in Android?"},"content":{"rendered":"<p>In this Android tutorial, we&#8217;ll learn about the Android Proguard tool. Let us start this tutorial without any delay.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78326\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool.jpg\" alt=\"Android proguard tool\" width=\"802\" height=\"420\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool.jpg 802w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool-520x272.jpg 520w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/a><\/p>\n<h2>What is Android Proguard Tool?<\/h2>\n<p>Android Proguard Tool is a free Java class file shrinker, optimizer, and obfuscator. Its task is to detect and eradicate the unused code. This can be either the class, method, field, or even the attributes. It also optimizes the bytecodes and removes the instructions that are not to be used.<\/p>\n<p>Android proguard does the following jobs:<\/p>\n<ul>\n<li><strong>Shrinking<\/strong>: Shrinking is the process of detecting the unusable parts of the code.<\/li>\n<li><strong>Optimizing<\/strong>: Optimizing is the process of analyzing the bytecodes of the methods.<\/li>\n<li><strong>Preverifier<\/strong>: Preverifying is the process of converting the optimized code into optimized jars and libs.<\/li>\n<li><strong>Obfuscating<\/strong>: Proguard Obfuscation is the process of renaming the leftover classes, fields, and methods.<\/li>\n<\/ul>\n<h2>Why do we use Proguard?<\/h2>\n<p>Now that you are well aware of what are Proguard tools and what these are used for, it would be easy for you to understand why it is needed.<\/p>\n<p>As Android applications are easy to reverse engineer, we use Proguard tools to restrict this from happening. And other reasons are very well clear to you that are-<\/p>\n<ul>\n<li>As it helps in removing the unwanted code, it makes the application work better and saves memory.<\/li>\n<li>It helps in reducing the complexities of the Android application code.<\/li>\n<li>It optimizes the functionalities of the application code, which ultimately maximizes the overall performance of the application.<\/li>\n<\/ul>\n<h2>What are the Advantages of Proguard in Android?<\/h2>\n<p>All the reasons for which we use Proguard for are definitely the Pros of Proguard tools. Nonetheless, let us consider the following advantages of Proguard-<\/p>\n<ul>\n<li>One of the best advantages is that it optimizes the code making it faster and better.<\/li>\n<li>It improvises the code format and rearranges it by removing unwanted parts of the code.<\/li>\n<li>This also helps in resources shrinking by removing unwanted resources.<\/li>\n<li>It helps in developing applications with the smallest possible size of the apk.<\/li>\n<li>It enhances the efficiency of the code of the application.<\/li>\n<\/ul>\n<h2>What are the Limitations of Android Proguard?<\/h2>\n<p>As we know, there&#8217;s the other side of everything; there&#8217;s the other side for this too. There are some disadvantages or rather drawbacks of <a href=\"https:\/\/stuff.mit.edu\/afs\/sipb\/project\/android\/docs\/tools\/help\/proguard.html\">Proguard<\/a> as well. Come, let&#8217;s see them one by one-<\/p>\n<ul>\n<li>At times, the misconfiguration causes the application to crash.<\/li>\n<li>After using the Proguard, the proper testing of the application is must.<\/li>\n<li>At times, it cannot make out if the code is unnecessary and removes the code.<\/li>\n<li>It is sometimes difficult to read the stack traces that have the names given by its obfuscated method.<\/li>\n<\/ul>\n<h2>How can I enable Proguard in Android Studio?<\/h2>\n<p>Now, We&#8217;ll see how to enable Proguard Android Studio. Proguard is basically integrated into the Android Build System. And it runs only when the build of your application is in the release mode. You can choose to use Android Proguard as it is not compulsory but is highly recommended. So, to enable or disable Proguard in your application you can use the minifyEnabled property present in build.gradle file.<\/p>\n<p>To enable the Proguard in your application you can do the following-<\/p>\n<p>1. Firstly, go to the build.gradle file of your application.<br \/>\n2. You will find the minifyEnabled property as a part of the buildTypes release block. It controls the settings applied to the release builds.<br \/>\n3. Now, all you have to do is, Set the minifyEnabled property to True. Thus the Proguard will be enabled in your application.<br \/>\n4. The method named getDefaultProguardFile(&#8216;proguard-android.txt&#8217;) is for obtaining the default Proguard settings from Android SDK tools.<\/p>\n<p>You can consider the following code and find it in <strong>build.gradle(:app) file:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">apply plugin: 'com.android.application'\r\n\r\nandroid {\r\n   compileSdkVersion 29\r\n   buildToolsVersion \"29.0.3\"\r\n\u2026\t\r\n   buildTypes {\r\n       release {\r\n           minifyEnabled true\r\n           proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'\r\n       }\r\n   }\r\n}<\/pre>\n<p>5.\u00a0At the root of the module, Android Studio adds the Proguard-rules.pro file that helps to add the custom Proguard rules.<\/p>\n<h2>Summary<\/h2>\n<p>In conclusion, this whole article was about Android Proguard tools. In this, we have everything about Proguard right from the tip to toe. Firstly, what we read in this article is what a Proguard tool is and why we use it. Then, we saw the Pros and Cons of the Proguard tool. And finally, we saw how we could implement the Proguard tool in our application in Android Studio.<\/p>\n<p>We hope you found it useful. Thank You.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1084,&quot;href&quot;:&quot;https:\\\/\\\/stuff.mit.edu\\\/afs\\\/sipb\\\/project\\\/android\\\/docs\\\/tools\\\/help\\\/proguard.html&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20240229030054\\\/https:\\\/\\\/stuff.mit.edu\\\/afs\\\/sipb\\\/project\\\/android\\\/docs\\\/tools\\\/help\\\/proguard.html&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 00:52:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2025-12-20 18:51:40&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-19 01:24:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-01-29 23:04:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-10 04:16:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-04 21:28:27&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-19 01:25:00&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-23 19:06:48&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-17 01:41:26&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-06-28 14:40:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-07-04 10:30:10&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-07-04 10:30:10&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this Android tutorial, we&#8217;ll learn about the Android Proguard tool. Let us start this tutorial without any delay. What is Android Proguard Tool? Android Proguard Tool is a free Java class file shrinker,&#46;&#46;&#46;<\/p>\n","protected":false},"author":10,"featured_media":78326,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18722],"tags":[22391,22388,22389,22390],"class_list":["post-78324","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android","tag-android-proguard-obfuscation","tag-android-proguard-tool","tag-proguard-obfuscation","tag-proguard-obfuscation-example"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Android Proguard Tool - How to Enable Proguard in Android? - DataFlair<\/title>\n<meta name=\"description\" content=\"Android Proguard tool - What is proguard in android and what is its use, how to enable it, advantages and limitations of android proguard tool.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/android-proguard\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android Proguard Tool - How to Enable Proguard in Android? - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Android Proguard tool - What is proguard in android and what is its use, how to enable it, advantages and limitations of android proguard tool.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/android-proguard\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-02T04:30:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-25T08:25:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Android Proguard Tool - How to Enable Proguard in Android? - DataFlair","description":"Android Proguard tool - What is proguard in android and what is its use, how to enable it, advantages and limitations of android proguard tool.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/android-proguard\/","og_locale":"en_US","og_type":"article","og_title":"Android Proguard Tool - How to Enable Proguard in Android? - DataFlair","og_description":"Android Proguard tool - What is proguard in android and what is its use, how to enable it, advantages and limitations of android proguard tool.","og_url":"https:\/\/data-flair.training\/blogs\/android-proguard\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-06-02T04:30:15+00:00","article_modified_time":"2021-08-25T08:25:00+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/android-proguard\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/android-proguard\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33"},"headline":"Android Proguard Tool &#8211; How to Enable Proguard in Android?","datePublished":"2020-06-02T04:30:15+00:00","dateModified":"2021-08-25T08:25:00+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-proguard\/"},"wordCount":722,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-proguard\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool.jpg","keywords":["android proguard obfuscation","Android Proguard Tool","proguard obfuscation","proguard obfuscation example"],"articleSection":["Android Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/android-proguard\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/android-proguard\/","url":"https:\/\/data-flair.training\/blogs\/android-proguard\/","name":"Android Proguard Tool - How to Enable Proguard in Android? - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/android-proguard\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/android-proguard\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool.jpg","datePublished":"2020-06-02T04:30:15+00:00","dateModified":"2021-08-25T08:25:00+00:00","description":"Android Proguard tool - What is proguard in android and what is its use, how to enable it, advantages and limitations of android proguard tool.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/android-proguard\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/android-proguard\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/android-proguard\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Android-proguard-tool.jpg","width":802,"height":420,"caption":"Android proguard tool"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/android-proguard\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Android Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/android\/"},{"@type":"ListItem","position":3,"name":"Android Proguard Tool &#8211; How to Enable Proguard in Android?"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team is passionate about delivering top-notch tutorials and resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With expertise in the tech industry, we simplify complex topics to help learners excel. Stay updated with our latest insights.","url":"https:\/\/data-flair.training\/blogs\/author\/dfadteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/78324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=78324"}],"version-history":[{"count":5,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/78324\/revisions"}],"predecessor-version":[{"id":78346,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/78324\/revisions\/78346"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/78326"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=78324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=78324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=78324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}