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

release打包 #22

Open
cc6522992 opened this issue Jun 10, 2022 · 2 comments
Open

release打包 #22

cc6522992 opened this issue Jun 10, 2022 · 2 comments

Comments

@cc6522992
Copy link

release打包测试环境支持切换可以配置吗?

@CodeXiaoMai
Copy link
Owner

CodeXiaoMai commented Jun 10, 2022

能否切换,需要看你的 gradle 中怎么配置,区别就在于 environmentswitcher-compiler 和 environmentswitcher-compiler-release 在处理注解时的逻辑不通。如果想在 release 包中支持切换环境,把 releaseAnnotationProcessor 中的注解处理器,配置成 environmentswitcher-compiler 就行了,或者干脆不区分 release 和 debug 配置。如下面所示:

dependencies {
    ...
    implementation "com.xiaomai.environmentswitcher:environmentswitcher:$version"
    annotationProcessor "com.xiaomai.environmentswitcher:environmentswitcher-compiler:$version"
}

@cc6522992
Copy link
Author

能否切换,需要看你的 gradle 中怎么配置,区别就在于 environmentswitcher-compiler 和 environmentswitcher-compiler-release 在处理注解时的逻辑不通。如果想在 release 包中支持切换环境,把 releaseAnnotationProcessor 中的注解处理器,配置成 environmentswitcher-compiler 就行了,或者干脆不区分 release 和 debug 配置。如下面所示:

dependencies {
    ...
    implementation "com.xiaomai.environmentswitcher:environmentswitcher:$version"
    annotationProcessor "com.xiaomai.environmentswitcher:environmentswitcher-compiler:$version"
}

我用逻辑配合框架实现了这个效果了 不过还是感谢大神🙏

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