Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to obfuscate android apk

hi i want obfuscate my apk but when i use minifyEnabled true my app crash in release mode, so i updated my as to 3.4.2 and i realized that there is a new system called R8 I have activated it, but my code is still readable

things i did

buildTypes {
        release {
            useProguard false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
    }

and in gradle.properties

android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
android.enableR8 = true

After the release apk, the code is visible by the jadx program I am confused now, can someone tell me how to obfuscate apk? enter image description here

like image 824
hadi khodabandeh Avatar asked Dec 23 '22 22:12

hadi khodabandeh


2 Answers

Open proguard-rules.pro for editing and add this:

# Uncomment this to preserve the line number information for
# debugging stack traces.
-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
-renamesourcefileattribute SourceFile

This will rename all of the classes to an unreadable format.

like image 157
RonTLV Avatar answered Dec 25 '22 23:12

RonTLV


Given the fact that proguard offers trivial obfuscation techniques (it is an optimizer) we have developed an APK obfuscator, check it out:

https://github.com/ClaudiuGeorgiu/Obfuscapk

like image 26
packmad Avatar answered Dec 25 '22 22:12

packmad