GithubHelp home page GithubHelp logo

Comments (19)

indieexplore avatar indieexplore commented on August 15, 2024

@vip7kk 有完整的日志吗

from app-code-obfuscation.

indieexplore avatar indieexplore commented on August 15, 2024

我把gradle和agp版本和你提供的保持一致,没发现问题🤔

from app-code-obfuscation.

vip7kk avatar vip7kk commented on August 15, 2024

我把gradle和agp版本和你提供的保持一致,没发现问题🤔

image
我这边是这样集成,因为项目gradle版本的原因,我没法用settings.gradle这里面集成方式

from app-code-obfuscation.

Moosphan avatar Moosphan commented on August 15, 2024

@vip7kk 如果还在用lacking的方式管理gradle依赖,那么可以基于下面的方式使用本插件:

Project -> build.gradle

buildscript {
    ext.kotlin_version = "1.5.21"
    repositories {
        google()
        mavenCentral()
        maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/"}
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.2.1"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'cn.dorck.android:code-guard-plugin:0.0.1-SNAPSHOT'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/"}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app/build.gradle

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'cn.dorck.code.guarder'
}

codeGuard {
    enable = true
    ...
}

from app-code-obfuscation.

vip7kk avatar vip7kk commented on August 15, 2024

@vip7kk 如果还在用lacking的方式管理gradle依赖,那么可以基于下面的方式使用本插件:

Project -> build.gradle

buildscript {
    ext.kotlin_version = "1.5.21"
    repositories {
        google()
        mavenCentral()
        maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/"}
    }
    dependencies {
        classpath "com.android.tools.build:gradle:7.2.1"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'cn.dorck.android:code-guard-plugin:0.0.1-SNAPSHOT'
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/"}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

app/build.gradle

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'cn.dorck.code.guarder'
}

codeGuard {
    enable = true
    ...
}

按照这种方式集成,又提示这种错误:Caused by: groovy.lang.MissingMethodException: No signature of method: build_c0t932d1s80wx9uco0ugds3o8.codeGuard() is applicable for argument types: (build_c0t932d1s80wx9uco0ugds3o8$_run_closure5) values: [build_c0t932d1s80wx9uco0ugds3o8$_run_closure5@3214f7d1]

from app-code-obfuscation.

vip7kk avatar vip7kk commented on August 15, 2024

我直接下载仓库demo运行,好像混淆没效果

from app-code-obfuscation.

Moosphan avatar Moosphan commented on August 15, 2024

我直接下载仓库demo运行,好像混淆没效果

执行 ./gradlew assembleRelease

from app-code-obfuscation.

vip7kk avatar vip7kk commented on August 15, 2024

我直接下载仓库demo运行,好像混淆没效果

执行 ./gradlew assembleRelease

试了也是没有混淆,反编译看了还是之前的代码...

from app-code-obfuscation.

indieexplore avatar indieexplore commented on August 15, 2024

@vip7kk demo里现在配置的是 debug 规则,并且约束了执行混淆的范围是 com.dorck.app.obfuscate.simple, 可以执行 ./gradlew assembleDebug 后去对应的包路径下面看看有无混淆

from app-code-obfuscation.

vip7kk avatar vip7kk commented on August 15, 2024

@vip7kk demo里现在配置的是 debug 规则,并且约束了执行混淆的范围是 com.dorck.app.obfuscate.simple, 可以执行 ./gradlew assembleDebug 后去对应的包路径下面看看有无混淆

image
依然没效果.....

from app-code-obfuscation.

Moosphan avatar Moosphan commented on August 15, 2024

@vip7kk demo里现在配置的是 debug 规则,并且约束了执行混淆的范围是 com.dorck.app.obfuscate.simple, 可以执行 ./gradlew assembleDebug 后去对应的包路径下面看看有无混淆

image

依然没效果.....

可以把 QQ 通过邮件发我,在线答疑🤓

from app-code-obfuscation.

vip7kk avatar vip7kk commented on August 15, 2024

打包会报错:Caused by: java.lang.AssertionError: symbolic reference class is not accessible: class sun.nio.ch.FileChannelImpl, from class org.jetbrains.kotlin.com.intellij.util.io.FileChannelUtil (unnamed module @9597028)

from app-code-obfuscation.

indieexplore avatar indieexplore commented on August 15, 2024

@vip7kk 怎么会没效果,把你的build.gradke的插件配置都发我看下

from app-code-obfuscation.

indieexplore avatar indieexplore commented on August 15, 2024

打包会报错:Caused by: java.lang.AssertionError: symbolic reference class is not accessible: class sun.nio.ch.FileChannelImpl, from class org.jetbrains.kotlin.com.intellij.util.io.FileChannelUtil (unnamed module @9597028)

这个是kt版本问题,不会中断打包流程,忽略就好,后面会适配

from app-code-obfuscation.

vip7kk avatar vip7kk commented on August 15, 2024

@vip7kk 怎么会没效果,把你的build.gradke的插件配置都发我看下

image
image
image
我下载仓库的demo运行打包apk反编译看垃圾代码没有生效,我自己项目集成就会报错:Caused by: groovy.lang.MissingMethodException: No signature of method: build_de5kcar3xd0thxphh0eycrpa6.codeGuard() is applicable for argument types: (build_de5kcar3xd0thxphh0eycrpa6$_run_closure5) values: [build_de5kcar3xd0thxphh0eycrpa6$_run_closure5@1605fb5a]

from app-code-obfuscation.

indieexplore avatar indieexplore commented on August 15, 2024

1. 自己项目中没有使用 kts 语法的,如果是用的 build.gradle,groovy 语法是:

HashSet<String> variants = new HashSet<>()
variants.add("debug")
codeGuard {
    enable = true
    variantConstraints = variants
}

2. 下载demo无效果问题

  • 确认下载的是最新的代码
  • 打包方式用的是什么,Android studio 中的 run 吗?可以尝试终端执行 ./gradlew :app:assembleDebug 看看效果

from app-code-obfuscation.

vip7kk avatar vip7kk commented on August 15, 2024

1. 自己项目中没有使用 kts 语法的,如果是用的 build.gradle,groovy 语法是:

HashSet<String> variants = new HashSet<>()
variants.add("debug")
codeGuard {
    enable = true
    variantConstraints = variants
}

2. 下载demo无效果问题

  • 确认下载的是最新的代码
  • 打包方式用的是什么,Android studio 中的 run 吗?可以尝试终端执行 ./gradlew :app:assembleDebug 看看效果

打包用的AS里面Build里的Generate Signed Bundle/APK,还是会报错:[DLogger]:onTransformBefore, extension: {
enable: true,
mapperFile: ,
obfuscationDictionary: ,
supportIncremental: true,
processingPackages: [co.aurphkh.ondfpsath],
isSkipAbsClass: true,
isAutoAdapted: true,
maxFieldCount: 10,
maxMethodCount: 8,
methodObfuscateEnable: true,
maxCodeLineCount: 6,
generatedClassPkg: ,
generatedClassName: ,
generatedMethodCount: 3,
excludeRules: [(R.class|BuildConfig.class)],
variantConstraints: [],
}
[DLogger]: AppCodeGuardConfig read config: {genClassMethodCount=3, excludeRulesList=[(R.class|BuildConfig.class)], javaCodeGenPath=D:\mjb\fens130\app\src\main\java\co\aurphkh\ondfpsath\s\o\x\Bh.java, availableVariants=[debug, release], isUseDefaultStrategy=true, javaCodeGenMainDir=D:\mjb\fens130\app/src/main/java/, genClassName=, genClassPkgName=, isEnableCodeObfuscateInMethod=true, currentBuildVariant=debug, processingPackages=[co.aurphkh.ondfpsath], applicationId=co.aurphkh.ondfpsath}
[DLogger]:variantMatches, rules: [], curVariant: debug
[DLogger]:Transform jar input size: 102, dir input size: 0
[DLogger]:Transform jar input size: 2, dir input size: 0
[DLogger]:Transform jar input size: 1, dir input size: 1
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$1.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$10.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$2.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$3.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$4.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$5.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$6.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$7.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$8$1.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$8.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$9$1.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$9$2.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a$9.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/a.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/b.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/BuildConfig.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/c$JavascriptCallback.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/c.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/d$1.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/d.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/databinding/MainBinding.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/e.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/f.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/g.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/h.class
[DLogger]:checkExcludes, found gen path, ignore processing: / >> D:/mjb/fens130/app/build/intermediates/javac/debug/classes/co/aurphkh/ondfpsath/i.class
[DLogger]:The transform time cost: 231ms
[DLogger]:[CodeGuardPlugin] >>> Start delete generated class, pkg exist: false, genPkgName:

Execution failed for task ':app:transformClassesWithCodeGuardTransformForDebug'.

Index: 1, Size: 1

from app-code-obfuscation.

indieexplore avatar indieexplore commented on August 15, 2024

@vip7kk 有更完整的信息吗,只看到一个类似数组越界的错,但没有定位到具体报错的地方

from app-code-obfuscation.

vip7kk avatar vip7kk commented on August 15, 2024

@vip7kk 有更完整的信息吗,只看到一个类似数组越界的错,但没有定位到具体报错的地方

日志全都贴出来了

from app-code-obfuscation.

Related Issues (8)

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.