[Gradle plugin] When i try to set the storePassword and keyPassword variants hooks, it skips zipAlign task

77 views
Skip to first unread message

Mario De Frutos

unread,
Feb 25, 2014, 4:38:53 AM2/25/14
to adt...@googlegroups.com
Hi everyone,

I'm trying to set the store and key passwords using readline from my console. I've set this properties using dex.doLast hook:

if (variant.dex!= null) {
variant.dex.doLast{
project.android.signingConfigs.release.storePassword = System.console().readLine("\n\$ Enter keystore password: ")
project.android.signingConfigs.release.keyPassword = System.console().readLine("\n\$ Enter key password: ")}
}

The funny thing is that the signing process occurs without any problem but it skips the zipAlign task.

If i set this properties inside the signingConfigs, it works fine:

release {
storeFile file("file.keystore")
storePassword System.console().readLine("\n\$ Enter keystore password: ")
keyAlias "alias"
keyPassword System.console().readLine("\n\$ Enter key password: ")
}

Anyone with this problem? Thx in advance

Xavier Ducrohet

unread,
Feb 25, 2014, 12:41:54 PM2/25/14
to adt...@googlegroups.com
This is because the zip-align task is only created if the signing is fully setup when the tasks are created.

We don't create the task if we think we're not going to run it.


--
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+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



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

Please do not send me questions directly. Thanks!

Mario De Frutos

unread,
Feb 25, 2014, 12:46:27 PM2/25/14
to adt...@googlegroups.com

Understood I put it in the signingconfig then.

Thx for your quick response Xavier :)

You received this message because you are subscribed to a topic in the Google Groups "adt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adt-dev/Fy8ZrDnhB2w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adt-dev+u...@googlegroups.com.

Xavier Ducrohet

unread,
Feb 25, 2014, 12:55:08 PM2/25/14
to adt...@googlegroups.com
Putting it in the signing config is not the right answer either.

Because it means it's going to query for the passwords every time it tries to evaluate the project, which means it'll happen when:
- you want to build the debug version
- you want to get the list of tasks, dependencies, projects, or when running any other non-build Gradle tasks.
- when the IDE asks for the model.

The last one is particularly bad as it breaks the IDE integration.

We need to fix this and always create the ZipAlign task even if signing doesn't occur, and make sure the task is properly skipped.

Mario De Frutos

unread,
Feb 25, 2014, 1:06:27 PM2/25/14
to adt...@googlegroups.com

That is what I thought because it is very annoying to  write the password even when assembleDebug is called.

I didn't fill and issue because I don't know if  was doing it wrong.

Again thank you very much for all and your efforts 

rciovati

unread,
Feb 26, 2014, 9:17:51 AM2/26/14
to adt...@googlegroups.com


Il giorno martedì 25 febbraio 2014 19:06:27 UTC+1, Mario De Frutos ha scritto:

That is what I thought because it is very annoying to  write the password even when assembleDebug is called.

You could try this approach: http://stackoverflow.com/a/19350401/321354 
Basically you provide a "fake" password in the configuration and then ask the real one just before it is needed (before packageRelease task).

Regards,

Mario De Frutos

unread,
Feb 26, 2014, 9:33:25 AM2/26/14
to adt...@googlegroups.com, adt...@googlegroups.com
Thx that will patch it by now ;)

--
Mario de frutos
--
Reply all
Reply to author
Forward
0 new messages