[Android] [PATCH] Version the libVLC .aar files

Jean-Baptiste Kempf jb at videolan.org
Mon Jun 22 10:05:46 CEST 2015


---
 libvlc/AndroidManifest.xml |  2 +-
 libvlc/build.gradle        | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/libvlc/AndroidManifest.xml b/libvlc/AndroidManifest.xml
index db7c453..8ff1c51 100644
--- a/libvlc/AndroidManifest.xml
+++ b/libvlc/AndroidManifest.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="org.videolan" android:versionCode="2" android:versionName="2.1">
+      package="org.videolan" android:versionCode="2" android:versionName="3.0.0">
     <application>
     <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="22"/>
 </application>
diff --git a/libvlc/build.gradle b/libvlc/build.gradle
index 2774386..9a0b26d 100644
--- a/libvlc/build.gradle
+++ b/libvlc/build.gradle
@@ -29,6 +29,21 @@ android {
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
         }
     }
+
+    // Make per-variant version code
+    libraryVariants.all { variant ->
+        def manifestParser = new com.android.builder.core.DefaultManifestParser()
+        // get the version code of each flavor
+        def vlcVersion = manifestParser.getVersionName(android.sourceSets.main.manifest.srcFile)
+        //Custom APK name
+        variant.outputs.each { output ->
+            def outputFile = output.outputFile
+            if (outputFile != null && outputFile.name.endsWith('.aar')) {
+                def fileName = "libvlc-${vlcVersion}.aar"
+                output.outputFile = new File(outputFile.parent, fileName)
+            }
+        }
+    }
 }
 
 /*
-- 
2.4.4



More information about the Android mailing list