Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

插件配置建议 #7

Closed
Krosxx opened this issue Jan 11, 2022 · 1 comment
Closed

插件配置建议 #7

Krosxx opened this issue Jan 11, 2022 · 1 comment

Comments

@Krosxx
Copy link

Krosxx commented Jan 11, 2022

作者你好,这里在使用中发现插件是在 project.afterEvaluate 进行处理

希望能够在执行期间再进行配置,这是方便针对 releasedebug 开动态开启 BlackObfuscator.enable

或有其他方式还请告知 thanks for your work :)

@nnjun
Copy link
Member

nnjun commented Jan 11, 2022

在app的gradle中增加如下方法,当使用assembleRelease才会进行开启

boolean isReleaseBuildType() {
    for(String s : gradle.startParameter.taskNames) {
        s = s.toLowerCase()
        if (s.contains("release")) {
            return true
        }
    }
    return false
}

BlackObfuscator {
    enabled isReleaseBuildType()
    depth 2
    obfClass = ["com.xxx"]
}

@nnjun nnjun closed this as completed Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants