Hi Xavier Ducrohet, even I was facing the similar issue and in the below
script in the getDate() function
*def formattedDate = date.format('yyyy-MM-dd-HH:mm') // this works*
*def formattedDate = date.format('yyyy-MM-dd-HH:mm:ss') // this doesn't.
and it gives local path doesnot exists (it has the 'ss' seconds switch)*
// script start
*android {*
* ....*
* defaultConfig {....}*
* buildTypes {*
* debug {*
* def formattedDate = getDate()*
* versionNameSuffix "debug-" + formattedDate*
* applicationVariants.all { variant ->
variant.outputs.each { output -> output.outputFile = new
File(output.outputFile.parent,*
* output.outputFile.name.replace("-debug", "-" +
formattedDate)*
* )*
* }*
* }*
* }*
* }*
* sourceSets {....}*
*}def getDate() { def date = new Date()*
* def formattedDate = date.format('yyyy-MM-dd-HH:mm') // this works*
*// def formattedDate = date.format('yyyy-MM-dd-HH:mm') // this doesn't.
and it gives local path doesnot exists.*
* return formattedDate*
*}*
// script end
*AndroidStudio Current version : 1.2 Preview 3 EAP.0 (build 141.1793788)*
*Gradle version : 2.2.1*
*any thoughts on this?*
On Wednesday, July 3, 2013 at 11:52:37 PM UTC+5:30, Xavier Ducrohet wrote:
>
> The fix requires a change on the gradle side. We have an upcoming
> synchronized released of the Gradle plugin and Studio with a modified model
> that will support this.
>
>
> On Wed, Jul 3, 2013 at 4:35 AM, Stefan Hoth <[email protected]
> <javascript:>> wrote:
>
>> Since the bug is not fixed in 1.0.9 I want to ask if there's way to
>> recognize that a build is started from Android Studio instead of the
>> console. This way I could skip the renaming while building in AS. Any
>> advice how I could achieve this?
>>
>> Thanks,
>> Stefan
>>
>>
>> On Wednesday, June 19, 2013 6:25:07 PM UTC+2, Xavier Ducrohet wrote:
>>
>>> BTW this code of yours is awful... (my fault, not yours).
>>>
>>> You should be able to do just this
>>>
>>> android.applicationVariants.each { variant ->
>>>
>>> def apk = variant.outputFile // you can already do that, and it'll
>>> return the right name whether you zip align or not
>>>
>>> // change apk to something else
>>> ...
>>>
>>> variant.outputFile = apk
>>> }
>>>
>>> Those methods already exist but the setter on variant.outputFile doesn't
>>> do the right thing.
>>>
>>>
>>> On Wed, Jun 19, 2013 at 9:03 AM, Stefan Hoth <[email protected]>
>>> wrote:
>>>
>>>> That's what I thought.
>>>>
>>>> "1 person starred this issue"
>>>>
>>>> Thanks,
>>>> Stefan
>>>>
>>>> On Wednesday, June 19, 2013 5:48:37 PM UTC+2, Xavier Ducrohet wrote:
>>>>
>>>>> I just took a quick look at it and the output file coming from the
>>>>> model is disconnected from the final task output (ie it's a copy not a
>>>>> link).
>>>>>
>>>>> https://code.google.com/p/android/issues/detail?id=56781
>>>>>
>>>>>
>>>>> On Wed, Jun 19, 2013 at 8:32 AM, Stefan Hoth <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Yes I did, of course. :-)
>>>>>>
>>>>>> The output after assembleMyFlavorDebug is called is:
>>>>>>
>>>>>> Uploading file
>>>>>> local path: C:\workspaces\myproject\app\build\apk\app-myFlavor-debug.
>>>>>> apk
>>>>>> remote path: /data/local/tmp/com.myapp.debug
>>>>>> Local path doesn't exist.
>>>>>>
>>>>>> Can you reproduce this behavior?
>>>>>>
>>>>>> Stefan
>>>>>>
>>>>>> On Wednesday, June 19, 2013 5:11:44 PM UTC+2, Xavier Ducrohet wrote:
>>>>>>
>>>>>>> did you reload the build.gradle?
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Jun 19, 2013 at 7:03 AM, Stefan Hoth <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> to have a better idea what I just build I renamed my APKs according
>>>>>>>> a few rules using this:
>>>>>>>>
>>>>>>>> buildTypes {
>>>>>>>> //debug, release, etc...
>>>>>>>>
>>>>>>>> applicationVariants.each { variant ->
>>>>>>>>
>>>>>>>> def apk = variant.packageApplication.outputFile;
>>>>>>>> def newName = "";
>>>>>>>>
>>>>>>>> newName = apk.name.replace(".apk", "-v" +
>>>>>>>> defaultConfig.versionName + "-" + variant.buildType.name.toUpperCase()
>>>>>>>> + ".apk");
>>>>>>>>
>>>>>>>> variant.packageApplication.outputFile = new
>>>>>>>> File(apk.parentFile, newName);
>>>>>>>> if (variant.zipAlign) {
>>>>>>>> variant.zipAlign.outputFile = new
>>>>>>>> File(apk.parentFile, newName.replace("-unaligned", ""));
>>>>>>>> }
>>>>>>>> }
>>>>>>>> }
>>>>>>>>
>>>>>>>> Result is something like "MyCoolApp-v1.0.15-RELEASE.apk"
>>>>>>>>
>>>>>>>> While this is working well on the cmd line I get an error when
>>>>>>>> trying to install the app from Android Studio since it doesn't pick up
>>>>>>>> the
>>>>>>>> changed name and only fails with
>>>>>>>> "Local path doesn't exist."
>>>>>>>>
>>>>>>>> Is there a rename the apk within gradle so Android Studio
>>>>>>>> understands it?
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>> Stefan
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> 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 [email protected].
>>>>>> 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!
>>>>>
>>>> --
>>>> 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.
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> 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 [email protected] <javascript:>.
>> 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!
>
--
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.