如何使用proguard.cfg保留我的测试方法 [英] How to keep my test methods with proguard.cfg
问题描述
对于我的Android工具测试,我需要在类中添加一些额外的入口点.这些方法未在实际应用中使用.我的想法是从所有test_
开始它们,并有一条通用规则将它们排除在优化之外.这是我走了多远:
For my Android instrumentation test I need a few extra entry point into my classes. Those methods are not used in the actual application. My idea was to start them all with test_
and have a general rule to exclude them from being optimized away. This is how far I got:
-keepclassmembers class com.xxx.**.* {
public ** test_* ();
public ** test_* (**);
public static ** test_* ();
public static ** test_* (**);
}
但是它仍然不起作用. public static void test_destroy (final android.content.Context context)
和private void dropTables (final SQLiteDatabase db)
刚刚从代码中删除.而且我不知道为什么.
But it still does not work. public static void test_destroy (final android.content.Context context)
and private void dropTables (final SQLiteDatabase db)
has just been removed from the code. And I have no idea why.
如何将其正确地用于通配符模式?
How is it properly used for wildcard patterns?
推荐答案
解决方案是
-keepclassmembers class com.XXX.**.* {
*** test_* (...);
}
这篇关于如何使用proguard.cfg保留我的测试方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!