Skip to main content

How to use Obfuscation in Android

 Security is main concern nowadays for our app .we want to secure our apps from hackers and also want it to be more complex to understand by anyone.To achieve this we use Obfuscation in Android .So lets start with brief information about Obfuscation.

What is Obfuscation:

According to the Oxford dictionary, obfuscation denotes that the action of making something obscure, unclear, or unintelligible. In software, the obfuscation of code is the process of modifying an executable so that it is no longer useful to unauthorized parties such as hackers but remains fully functional. Or in other ways we can say that 

To protect trade secrets, processes, unauthorized access, vulnerability discovery and bypassing licensing or other controls can be done by using obfuscation.

Advantages of Using Obfuscation:

1. Optimized Code   is one of the most important feature of using Obfuscation the code become more optimized after applying Obfuscation.

2. Security  is also a feature of Obfuscation .By using this we can achieve more security for our code because it convert the code into human Unreadable format.

3.Track Illegal Copies  by using Obfuscation is one of its feature .By using this feature we can reduce the cloning of apps.

Obfuscation Tools:

There are a few tools related to Android Studio such as ProGuard and DexGuard. ProGuard is a free tool that is included in Android Studio, DexGuard which is a commercial version of ProGuard. 

How to use  Obfuscation in Android :

There is very simple step to apply Obfuscation in our Android Project .First, we need to enable minifyEnabled true from its default value which is false in app-level Gradle file in Android Studio.


If you are adding your own ProGuard rules, you can modify the code .To obfuscate the code in a more complex form you could go to your root directory app and create a .pro file, for example proguard-rules-new.pro, in the same directory you should see a file called proguard-rules.pro file.

Now add the file you have created to the build.gradle file.

After Generating apk try to decompile the apk file you will find the classes becomes in un-readable format like this:



That's all Thank you for reading this post.




Comments

Popular posts from this blog

How to Download Apk file from Url and Install Programmatically

In this post we learn about download apk file from server or website and then install it Programmatically in Phone. Sometimes we have to download external apk file from server and then install if downloading successfully finished.For this we use AsyncTask class  for background process. So here is Code Snippet for this task.Lets Start :- Before this we have to add these Permissions in Manifest.xml file : <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> DownloadNewVersion.java class DownloadNewVersion extends AsyncTask<String,Integer,Boolean> { @Override protected void onPreExecute() { super.onPreExecute(); bar = new ProgressDialog(getActivity()); bar.setCancelable(false); bar.setMessage("Downl...

Working with Android 11 (Changes and Security Features)

 Hello everyone , I am here with new article which is hot topic nowadays "Android 11" .The stable version of Android.  Android 11 is the eleventh major release and 18th version of Android, the mobile operating system developed by the Open Handset Alliance led by Google. It was released on September 8, 2020.It is comes with many security features and other features as well . And it is now compulsory in play store  to upload new apps with API lavel 30 which is compatible with Android 11 and from November onwards old apps also have to update with API 30 .Some other guidelines you can check out from here . Play Store Guidelines So its clear that we have to update our apps with API level 30 .But Android 11 comes with some changes as well which we have to do in our projects. For example from Android developer site "Android 11 (API level 30) further enhances the platform, giving better protection to app and user data on external storage. ". Scoped storage enforcement: Apps...

How to Disable Edge-to-Edge Mode in Android 15 and Android 16

How to Disable Edge-to-Edge Mode in Android 15 and Android 16 How to Disable Edge-to-Edge Mode in Android 15 and Android 16 With each new Android version, Google continues to enhance UI experiences by embracing modern, immersive design principles. Starting with Android 10, edge-to-edge mode has become the standard, allowing apps to extend their content beneath system bars for a more immersive display. In Android 15 and the upcoming Android 16 releases, edge-to-edge mode remains a core part of the UI framework, leveraging gestures and providing richer visual experiences. However, as developers, there are times when we may want to disable edge-to-edge mode — whether for legacy app compatibility, ensuring content fidelity, or managing complex UI layouts. In this detailed guide, we'll explore how you can disable edge-to-edge mode in Android 15 and Android 16. We will cover the background of edge-to-edge, why you might want to di...