Giter VIP home page Giter VIP logo

Comments (7)

Saint-Theana avatar Saint-Theana commented on June 4, 2024 1

有办法了
1: 关掉r8
gradle.properties中加入下面几条
android.enableR8.fullMode=false
android.enableR8=false
android.enableR8.libraries=false

2:最外层的build.gradle内的buildscript中加入

buildscript {
...
configurations.all {
resolutionStrategy {
dependencySubstitution {
substitute module('net.sf.proguard:proguard-gradle') with module('com.guardsquare:proguard-gradle:7.0.1')
}
}
}
}

3:然后在app里的build.gradle中修改
buildTypes {
release {
...
minifyEnabled false
useProguard false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

然后在app内的build.gradle中的apply plugin: 'stringfog'之前加上apply plugin: 'proguard'

总之就是r8模式没办法在shrink跟d8之前操作class,如果是舍弃r8,在proguard和d8之间还是有余地的。

from stringfog.

xloger avatar xloger commented on June 4, 2024

我也有同样的困扰,我查阅后发现了一个基于 StringFog 二次开发的插件:https://github.com/ysrc/obfuseSmaliText
它提供了直接对 apk 字符串混淆的方式,我试验了一下能达到想要的效果。在项目目录放入对应 jar,然后 gradle 加入如下代码:

    applicationVariants.all{ variant ->  //module工程则为libraryVariants,主项目则是applicationVariants
        variant.javaCompile.doLast{
            println  ("start classes obfuscation "+"${variant.javaCompile.destinationDir}")
            javaexec {
                main = "-jar"
                args = [
                        "../obfuseStringGradle.jar",
                        project.name,
                        variant.javaCompile.destinationDir
                ]
            }
        }
    }

from stringfog.

pengweiwww avatar pengweiwww commented on June 4, 2024

同有这个问题。楼上的方案或许可以解决,但需要舍弃R8,不够完美。
最好的方案是StringFog支持这个功能,自动删除Log.i等日志方法,进一步降低反编译风险~

from stringfog.

Saint-Theana avatar Saint-Theana commented on June 4, 2024

同有这个问题。楼上的方案或许可以解决,但需要舍弃R8,不够完美。 最好的方案是StringFog支持这个功能,自动删除Log.i等日志方法,进一步降低反编译风险~

不是或许,是一定可以,我一直都是这么做的。
r8替换为proguard后的确是可以做到将transform插到压缩混淆的后面,从而杜绝许多可能发生的问题。

from stringfog.

tpnet avatar tpnet commented on June 4, 2024

@MegatronKing 大佬有办法直接支持吗,现在问题是这样子的: 打包时在混淆里面使用assumenosideeffects去掉了log,但是反编译后会发现要打印的字符串还在代码里面。
image

from stringfog.

MegatronKing avatar MegatronKing commented on June 4, 2024

@tpnet 好像某种情况下是有和assumenosideeffects有冲突,但我记不太清了,你有没有用非官方的proguard库?

from stringfog.

tpnet avatar tpnet commented on June 4, 2024

@MegatronKing 这个问题用的是官方的混淆。 但我昨晚也尝试用了 第三方proguard库,我自己的代码出现了method too large的问题,还有会导致打包出来之后Stringfog类找不到

from stringfog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.