how to obfuscate android apk

hadi khodabandeh :

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

RonTLV :

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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=126199&siteId=1
Recommended