Reputation: 11
Here's my current proguard file. I have my unit tests and UI tests in folders androidTest and Test respectively.
-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 *
Upvotes: 0
Views: 781
Reputation: 2386
The short answer is, you don't need to. androidTest
and test
source sets aren't included in the APK you get when you build, so you don't need to worry about stripping them out with ProGuard.
You can check for yourself by building an APK, and looking at it with Android Studio's APK Analyzer (just double click the resulting APK under build/outputs/apk
). Look for your test classes. You shouldn't see them.
Upvotes: 2