Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #Below is the example for how to make gradle to have apk file name with version.
  2.  
  3.  
  4. apply plugin: 'com.android.application'
  5.  
  6. android {
  7. signingConfigs {
  8. config {
  9. ... SOMETHING LIKE RELEASE SIGNING CONFIG ...
  10. }
  11. }
  12.  
  13. compileSdkVersion 23
  14. buildToolsVersion "23.0.2"
  15.  
  16. project.archivesBaseName = "LMS"; // HERE YOU NEED TO PROVIDE PROJECT NAME (BASE NAME)
  17.  
  18. signingConfigs {
  19. release {
  20. keyAlias 'ALIAS_NAME'
  21. keyPassword 'ALIAS_PASWORD'
  22. storeFile file('C:/../../.android/KEYSTORE_NAME.keystore')
  23. storePassword 'KEYSTORE_PASSWORD'
  24. }
  25. }
  26. defaultConfig {
  27. ...
  28. }
  29. buildTypes {
  30. release {
  31. minifyEnabled false
  32. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  33.  
  34. // HERE YOU NEED TO DEFINE THE APK FILE NAME AS LIKE BELOW
  35. applicationVariants.all { variant ->
  36. variant.outputs.each{ output ->
  37. output.outputFile = new File(output.outputFile.parent,output.outputFile.name.replace(".apk","_v" + defaultConfig.versionName + ".apk" ))
  38. }
  39. }
  40. }
  41. }
  42. productFlavors {
  43. staging {
  44. ...
  45. }
  46. live {
  47. ...
  48. }
  49. }
  50. }
  51.  
  52. dependencies {
  53. compile fileTree(include: ['*.jar'], dir: 'libs')
  54. testCompile 'junit:junit:4.12'
  55. ...
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement