Hi,

Scenario:
>From time to time the app gets broken when using proguard. This is either 
during the building process which is an easier case or during the app start 
on a device usually with some missing classes. To address this I want to 
enable proguard for the debug build and run simple 'sanity' integration 
tests. (I understand it will make actual debugging harder but I would like 
to have at least one build variant with proguard enabled i can test 
automatically).

Problem:
If i enable proguard like this:

runProguard true
proguardFile 'proguard.cfg'

The build will be fine but it will also try to run proguard on the test 
apk. It forces me to introduce a test app specific proguard configuration. 
I want to use the same configuration i use for the release apk.
I can disable proguard task:

gradle.projectsEvaluated {
    proguardDebugTest.enabled = false
}

 This will make the build fail because it wont run :preDexDebugTest and 
the :dexDebugTest task will have no input:

Execution failed for task ':dexDebugTest'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run 
command:
        D:\Dev\Android SDK\build-tools\19.0.1\dx.bat --dex --output 
D:\Workspace\keepsafe\KeepSafe\mobile\android\build\dex\test\debug
Error Code:
        1
Output:
        no input files specified



I've searched SO and this group but can't find any answer to my problem. 
Does anybody have a configuration like this running successfully?
If it can't be done like this:

   - Can I make integration tests take a release apk?
   - The android plugin registers tasks depending on the configuration. If 
   i turn proguard on :preDexDebugTest wont even get registered. Wouldn't it 
   make more sense to register them anyway and build the dependsOn chain 
   depending on configuration?

There is one thing I've noticed while going through the sources. 
BasePlugin.groovy:1414 
has a flag like this:

boolean runProguard = variantConfig.buildType.runProguard &&
                (variantConfig.type != TEST ||
                        (variantConfig.type == TEST &&
                                variantConfig.testedConfig.type != 
VariantConfiguration.Type.LIBRARY))

Why it makes sense to run proguard if the test apk is not a library but it 
doesn't make sense for a library. Is there any reason to run proguard for 
the test apk at all?

Sorry if this something crazy I'm trying to do, I'm new to Android. I'd be 
grateful for any tips how I can solve this.

Thanks,
Tomek

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to