[Android] Fix BuildConfig.VERSION_CODE not set

Geoffrey Métais git at videolan.org
Tue Feb 27 15:35:25 CET 2018


vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Feb 27 15:26:35 2018 +0100| [94a66434bf9529e0769a5625720c621f7d9d61fa] | committer: Geoffrey Métais

Fix BuildConfig.VERSION_CODE not set

(cherry picked from commit 676a57c2f69a76a37e64f3e264f69ac457e56de0)

> https://code.videolan.org/videolan/vlc-android/commit/94a66434bf9529e0769a5625720c621f7d9d61fa
---

 vlc-android/build.gradle | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 0a829d99f..1dba16b6d 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -136,6 +136,8 @@ android {
     // make per-variant version code
     applicationVariants.all { variant ->
 
+        def generatedCode = variant.productFlavors.get(0).versionCode * 10000000 + defaultConfig.versionCode + variant.productFlavors.get(1).versionCode
+        variant.mergedFlavor.versionCode = generatedCode
         //Custom APK name
         variant.outputs.all { output ->
             def outputName = "VLC-Android-"
@@ -145,7 +147,6 @@ android {
             outputFileName = outputName
             output.processManifest.doLast {
                 // set the composite code
-                def generatedCode = variant.productFlavors.get(0).versionCode * 10000000 + defaultConfig.versionCode + variant.productFlavors.get(1).versionCode
                 String manifestPath = "$manifestOutputDirectory/AndroidManifest.xml"
                 def manifestContent = file(manifestPath).getText()
                 manifestContent = manifestContent.replace('android:versionCode="1"',



More information about the Android mailing list