如何混淆android apk

had*_*deh 7 java obfuscation android proguard

嗨,我想混淆我的 apk,但是当我使用minifyEnabled true时,我的应用程序在发布模式下崩溃,所以我将我的 as 更新到 3.4.2,我意识到有一个名为 R8 的新系统我已经激活了它,但我的代码仍然可读

我做的事

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

并在 gradle.properties 中

android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m
android.enableR8 = true
Run Code Online (Sandbox Code Playgroud)

发布apk后,jadx程序可以看到代码我现在很困惑,有人可以告诉我如何混淆apk吗? 在此输入图像描述

Ron*_*TLV 7

打开proguard-rules.pro进行编辑并添加以下内容:

# 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
Run Code Online (Sandbox Code Playgroud)

这会将所有类重命名为不可读的格式。


Sim*_*nzo 6

鉴于 proguard 提供了简单的混淆技术(它是一个优化器),我们开发了一个 APK 混淆器,请查看:

https://github.com/ClaudiuGeorgiu/Obfuscapk