Comments (7)
有办法了
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.
我也有同样的困扰,我查阅后发现了一个基于 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.
同有这个问题。楼上的方案或许可以解决,但需要舍弃R8,不够完美。
最好的方案是StringFog支持这个功能,自动删除Log.i等日志方法,进一步降低反编译风险~
from stringfog.
同有这个问题。楼上的方案或许可以解决,但需要舍弃R8,不够完美。 最好的方案是StringFog支持这个功能,自动删除Log.i等日志方法,进一步降低反编译风险~
不是或许,是一定可以,我一直都是这么做的。
r8替换为proguard后的确是可以做到将transform插到压缩混淆的后面,从而杜绝许多可能发生的问题。
from stringfog.
@MegatronKing 大佬有办法直接支持吗,现在问题是这样子的: 打包时在混淆里面使用assumenosideeffects去掉了log,但是反编译后会发现要打印的字符串还在代码里面。
from stringfog.
@tpnet 好像某种情况下是有和assumenosideeffects有冲突,但我记不太清了,你有没有用非官方的proguard库?
from stringfog.
@MegatronKing 这个问题用的是官方的混淆。 但我昨晚也尝试用了 第三方proguard库,我自己的代码出现了method too large
的问题,还有会导致打包出来之后Stringfog类找不到
from stringfog.
Related Issues (20)
- 编译失败,应该怎么处理 Cannot constrain type: INT for value: HOT 3
- agp 7.4.2通不过编译了 HOT 1
- 打出的aar包运行报错:java.lang.NoClassDefFoundError: Failed resolution of: Lcom/github/megatronking/stringfog/xor/StringFogImpl; HOT 4
- xml不能加密,字符串国际化怎么处理 HOT 1
- 有没鸿蒙版本的么? HOT 1
- StringFogExtension的fogPackages不能被赋值,Val cannot be reassigned HOT 1
- 我的aar和app都要集成StringFog,如何防止二次加密? HOT 1
- Application的string没被混淆 HOT 2
- 5.0.0遇到的一些问题 HOT 5
- 报错:> Unexpected scopes found in folder ‘app/build/intermediates/transforms/stringFog/gp/release' . Required: EXTERNAL_LIBRARIES, SUB_PROJECTS. Found: EXTERNAL_LIBRARIES, PROJECT, SUB_PROJECTS
- 个别情况下, string 看起来不会被fog,字面量?编译器优化将常量直接带入? HOT 3
- java8应该使用哪个版本的StringFog HOT 1
- 不太会用,报错了,烦请大哥指点一下 HOT 5
- Plugin Gradle release please HOT 1
- Unable to resolve applicationID HOT 3
- StringFogExtension报错 HOT 1
- java.lang.NoClassDefFoundError: Failed resolution of: Lcom/github/megatronking/stringfog/xor/StringFogImpl; HOT 3
- id 'stringfog' 以后就报错,版本是4.0.1 HOT 2
- 'ObjectOutputStream.putFields' is not supported by the Gradle configuration cache HOT 1
- 5.0.0 build.gradle8.0遇到的报错 HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stringfog.