That's correct, you need to use output.outputFile.

This is because the pacakgeApplication task may not be the final task
outputting the APK file. If the packageApplication task does the signing
(or even if there is custom signing), then zipAlign is run after and
zipAlign is the final task.

In my snippet you can see the call to output.setOutputFile to reset the
output file to the output of the custom signing. If you use ZipAlign, then
output.createZipAlignTask does this automatically.



On Sat, Mar 7, 2015 at 1:35 PM, Tomáš Procházka <tomas.procha...@gmail.com>
wrote:

> Maybe it is bug in the android-command plugin itself
> https://github.com/novoda/gradle-android-command-plugin/issues/74
>
> But what is difference between output.packageApplication.outputFile and
> output.outputFile?
>
> I did temporary workaround for it in this way
> zipAlignTask.doLast {output.packageApplication.outputFile =
> zipAlignTask.outputFile}
>
> Gradle is nice that everything is possible to change, but it brings a lot
> of issues :-(
>
> Dne sobota 7. března 2015 22:19:11 UTC+1 Tomáš Procházka napsal(a):
>
>> H Xavier
>>
>> I have small question to you code here
>> https://gist.github.com/ducrohet/e0d854c54bd0ceeb7044
>>
>> I'm using it for remote signing of the APK
>>
>> And I'm also using android-command plugin which allows me to deploy and
>> run apk directly to phone, which is not possible directly by android gradle
>> plugin.
>>
>> But problem is that android-command always use unsigned version of the
>> code.
>> It looks that this plugin always use output.packageApplication.outputFile
>> which is not touch by code in your example.
>>
>> How to update the path to the signed and zipaligned version of the APK
>> after signTask and ZipAlign task is done in proper way?
>>
>> For example if zip align is disabled you have 
>> output.setOutputFile(signTask.outputFile),
>> but it is not used if zip align is enabled. I tried to
>> put output.setOutputFile(zipAlignTask.outputFile) before line 22, but it
>> doesn't help.
>>
>  --
> 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 adt-dev+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. Thanks!

-- 
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 adt-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to