shwenzhang / AndResGuard

proguard resource for Android by wechat team
Apache License 2.0
8.54k stars 1.54k forks source link

直接把resguardRelease放在assembleRelease之后自动执行是否有风险呢? #339

Open TZHANHONG opened 5 years ago

TZHANHONG commented 5 years ago

大神您好,我直接把resguardRelease放在了assembleRelease之后去执行,这样每次build apk的时候就会自动进行资源混淆了,但是不知道这样是否会有潜在的风险,比如说你以后可能会改变resguardRelease这个任务的名称。

我是在build.gradle中这样做的。 project.afterEvaluate { tasks.matching { it.name.equals("assembleRelease") }.each { task -> task.finalizedBy("resguardRelease") } }

simpleton commented 5 years ago

resguardRelease 会调用assembleRelease的

On Wed, May 29, 2019 at 8:56 PM TZHANHONG notifications@github.com wrote:

大神您好,我直接把resguardRelease放在了assembleRelease之后去执行,这样每次build apk的时候就会自动进行资源混淆了,但是不知道这样是否会有潜在的风险,比如说你以后可能会改变resguardRelease这个任务的名称。

我是在build.gradle中这样做的。 project.afterEvaluate { tasks.matching { it.name.equals("assembleRelease") }.each { task -> task.finalizedBy("resguardRelease") } }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/shwenzhang/AndResGuard/issues/339?email_source=notifications&email_token=AADO6YV4NB5LYYIKXCL3RFLPX5F5ZA5CNFSM4HQ4IHHKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GWUIOKA, or mute the thread https://github.com/notifications/unsubscribe-auth/AADO6YVSDPYFGXBWRSCEE23PX5F5ZANCNFSM4HQ4IHHA .

TZHANHONG commented 5 years ago

是的,我知道,我只是不想每次都需要手动去点击as上的resguardRelease来执行,我想点击build apk的时候便能够在最后自动混淆资源,这样在Jenkins上打包的时候或许就可以去成功地进行资源混淆,不需要在jenkins上有其他配置了。

beyondckw commented 5 years ago

你这样试了有效果吗?我这边好像不行?

TZHANHONG commented 5 years ago

我这边是可以的,我用上面那个方法将混淆的任务放到最后。你可以看一下,先不要将混淆的task放在最后的,点击build apk,在build窗口看一下最后执行的task是不是app:assembleRelease

beyondckw commented 5 years ago

R8编译你试过吗?

TZHANHONG commented 5 years ago

没有用R8

zjn0505 commented 5 years ago

我遇到了这种场景,在用 F-Droid 平台打包的时候,编译的 task 不由开发者决定,而是强制为 assemble + flavor + Release

https://gitlab.com/fdroid/fdroidserver/blob/6d11da5e1383d00059ca1ed01467a85aca0c8b92/fdroidserver/build.py#L433

gradletasks += ['assemble' + flavours_cmd + 'Release']