Indeed you can check on this property to disable this feature from the IDE.

On Thu, Nov 6, 2014 at 12:55 PM, Tomáš Procházka <[email protected]>
wrote:

> Thanks for explanation.
>
> I'm using this
>
> project.ext.renameApk = { variant ->    variant.outputs.each { output ->      
>   File file = output.outputFile        String gitHash = getGitHash()        
> *def *name =  
> output.outputFile.name.replace(*"-"*,*","*).replace(project.name+*","*,       
>          project.parent.name + *"-" *+ project.name + *"-" *+                
> project.VERSION + *"-" *+ variant.mergedFlavor.versionCode + *"-" *+          
>       gitHash + *"-"*)        output.outputFile = *new *File(file.parent, 
> name)    }}
>
>
> And it's generate name like this
>
> tvprogram-app-1.0.0-SNAPSHOT-73-d7884c4-debug,flavour1,xhdpi.apk
>
>
> So. If it is not possible to force AS to use new name automatically, I
> will use *android.injected.invoked.from.ide* to detect IDE build and will
> rename apk only for builds from command line.
>
>
> Dne čtvrtek, 6. listopadu 2014 20:32:39 UTC+1 Xavier Ducrohet napsal(a):
>>
>> You cannot change the generated APK to be dynamic.
>>
>> When Studio syncs the project, it gets a model that indicates the APK
>> location. If the APK location changes on subsequent builds, Studio will
>> still be looking for the APK indicated in the model at the time of the sync.
>>
>> The way you would do it is to make a copy of the APK with the name you
>> want. You probably only want to do this on the build server with a
>> post-build task or something, as it makes little sense during development.
>>
>> On Thu, Nov 6, 2014 at 8:10 AM, Tomáš Procházka <[email protected]>
>> wrote:
>>
>>> Hi.
>>>
>>> I have modified build script which change name of result APK which
>>> contain GIT commit hash number, so name of app is different after every
>>> commit or update local copy.
>>> Android Studio use gradle to build so I thought that it will be no
>>> problem.
>>> But AS in some way cache result APK name and trying to deploy old one if
>>> commit hash was changed.
>>> It is necessary to synchronize gradle script after every GIT change.
>>> Why this happen?
>>> If AS run gradle script for every build/run it must know the name of
>>> result file.
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> 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.
>



-- 
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.

Reply via email to