首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用proguard从我的生产构建中排除我的测试类?

如何使用proguard从我的生产构建中排除我的测试类?
EN

Stack Overflow用户
提问于 2018-03-20 03:28:05
回答 1查看 393关注 0票数 0

这是我当前的proguard文件。我的单元测试和UI测试分别放在文件夹androidTest和Test.

代码语言:javascript
复制
-target 1.7 #Target version
-dontusemixedcaseclassnames #Specifies not to generate mixed-case class names while obfuscating
-dontskipnonpubliclibraryclasses #Specifies not to ignore non-public library classes
-dontpreverify #Specifies not to preverify the processed class files. when eventually targeting Android, it is not necessary, so you can then switch it off to reduce the processing time a bit.
-verbose #Specifies to write out some more information during processing

-optimizations !code/simplification/arithmetic,!code/allocation/variable
-keep class **
-keepclassmembers class *{*;}
-keepattributes *
EN

回答 1

Stack Overflow用户

发布于 2018-03-20 08:08:02

简短的答案是,你不需要这样做。androidTesttest源码集不包括在您构建时获得的APK中,因此您不需要担心使用ProGuard剥离它们。

你可以自己构建一个应用程序包,然后用Android Studio的应用程序包分析器查看它(只需双击build/outputs/apk下的结果应用程序包)。查找您的测试类。你不应该看到他们。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49370903

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档