The createZipAlignTask introduced in Gradle Plugin for Android 0.8 seems to 
work:

android.testVariants.all { variant ->
    // Add zip align task
    def file = variant.outputFile
    variant.createZipAlignTask("zipAlignTest${variant.name}", file, 
       new File(file.parent, file.name.replace("-unaligned","")))
}

On Saturday, November 2, 2013 3:33:28 AM UTC+7, Vladimir Zvezda wrote:
>
> Hello, 
>
> How do I zipalign the test apk? 
>
> What I was thinking about:
>   * There seems no build script block to define something like 
> "instrumentTest { zipAlign true }". testOptions does not seems to work. 
>   * The property is not available for setting via android.testVariants.all 
> { variant -> variant.zipAlign = true } ("Cannot set the value of read-only 
> property 'zipAlign' on ...")
>   * Test project does not take the properties from the buildType.debug. It 
> seems to take them from defaultConfig, but it is not allowed to set 
> zipAlign there
>   * In the end, hopeless, I was trying to create the zipalign task 
> manually:
>      android.testVariants.all { variant -> 
>          def alignApp = project.tasks.create "zipAlignTest${variant.name}", 
> ZipAlign
>          // ...
>      }
>
>     But this also has the build problem:
>     Could not find property 'ZipAlign' on 
> com.android.build.gradle.internal.api.TestVariantImpl_Decorated@8afbefd.
>
> Gradle 1.8/com.android.tools.build:gradle:0.6.+
>

-- 
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/groups/opt_out.

Reply via email to