[Android] AGP 3.0.0 migration

Geoffrey Métais git at videolan.org
Mon Dec 11 16:42:18 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Nov  6 16:21:42 2017 +0100| [c74773ea08053c28dc3118ebe517d39810150e81] | committer: Geoffrey Métais

AGP 3.0.0 migration

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

 api/build.gradle               |  6 +++---
 build.gradle                   | 10 ++++------
 java-libs/axmlrpc/build.gradle |  2 +-
 libvlc/build.gradle            | 11 +++++------
 medialibrary/build.gradle      | 11 ++++++-----
 vlc-android/build.gradle       | 29 +++++++++++++++--------------
 6 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/api/build.gradle b/api/build.gradle
index 9f6455480..c45a79a78 100644
--- a/api/build.gradle
+++ b/api/build.gradle
@@ -57,9 +57,9 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
 }
 
 dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
-    compile "com.android.support:appcompat-v7:$rootProject.ext.appCompatVersion"
-    testCompile 'junit:junit:4.12'
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+    api "com.android.support:appcompat-v7:$rootProject.ext.appCompatVersion"
+    testApi 'junit:junit:4.12'
 }
 
 def properties = new Properties()
diff --git a/build.gradle b/build.gradle
index 97c77fc8f..77119c26a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,10 +2,11 @@
 buildscript {
     repositories {
         flatDir dirs: "gradle/plugins"
+        google()
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:2.3.3'
+        classpath 'com.android.tools.build:gradle:3.0.1'
         classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
         classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
     }
@@ -13,10 +14,7 @@ buildscript {
 
 allprojects {
     repositories {
-        maven {
-            url 'https://maven.google.com'
-            // Alternative URL is 'https://dl.google.com/dl/android/maven2/'
-        }
+        google()
         jcenter()
     }
 }
@@ -24,7 +22,7 @@ allprojects {
 ext {
     appCompatVersion = '25.2.0'
     constraintLayoutVersion = '1.1.0-beta3'
-    buildToolsVersion = "26.0.1"
+    buildToolsVersion = "27.0.2"
     compileSdkVersion = 26
     minSdkVersion = 9
     targetSdkVersion = 26
diff --git a/java-libs/axmlrpc/build.gradle b/java-libs/axmlrpc/build.gradle
index 29efeff0c..605394b3a 100644
--- a/java-libs/axmlrpc/build.gradle
+++ b/java-libs/axmlrpc/build.gradle
@@ -2,5 +2,5 @@ apply plugin: 'java'
 sourceCompatibility = 1.6
 targetCompatibility = 1.6
 dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
 }
\ No newline at end of file
diff --git a/libvlc/build.gradle b/libvlc/build.gradle
index 8ff47ef5c..5b3e11f09 100644
--- a/libvlc/build.gradle
+++ b/libvlc/build.gradle
@@ -35,14 +35,13 @@ android {
         manifestParser = new DefaultManifestParser(file('../vlc-android/AndroidManifest.xml'))
         def androidVersion = manifestParser.getVersionName()
         //Custom APK name
-        variant.outputs.each { output ->
-            def outputFile = output.outputFile
-            if (outputFile != null && outputFile.name.endsWith('.aar')) {
-                def fileName = "libvlc-${vlcVersion}-${androidVersion}.aar"
-                output.outputFile = new File(outputFile.parent, fileName)
+        variant.outputs.all { output ->
+            if (outputFileName != null && outputFileName.endsWith('.aar')) {
+                outputFileName = "libvlc-${vlcVersion}-${androidVersion}.aar"
             }
         }
     }
+    buildToolsVersion '26.0.2'
 }
 
 /*
@@ -104,5 +103,5 @@ clean {
 }
 
 dependencies {
-    compile "com.android.support:support-annotations:$rootProject.ext.appCompatVersion"
+    api "com.android.support:support-annotations:$rootProject.ext.appCompatVersion"
 }
diff --git a/medialibrary/build.gradle b/medialibrary/build.gradle
index 9fcb7828a..75842a290 100644
--- a/medialibrary/build.gradle
+++ b/medialibrary/build.gradle
@@ -50,6 +50,7 @@ android {
     dataBinding {
         enabled = true
     }
+    buildToolsVersion '26.0.2'
 }
 
 task generateSources (type: Jar) {
@@ -62,9 +63,9 @@ clean {
 }
 
 dependencies {
-    compile project(':libvlc')
-    compile "com.android.support:support-v4:$rootProject.ext.appCompatVersion"
-    compile "com.android.support:support-compat:$rootProject.ext.appCompatVersion"
-    compile "com.android.support:support-fragment:$rootProject.ext.appCompatVersion"
-    testCompile 'junit:junit:4.12'
+    implementation project(':libvlc')
+    api "com.android.support:support-v4:$rootProject.ext.appCompatVersion"
+    api "com.android.support:support-compat:$rootProject.ext.appCompatVersion"
+    api "com.android.support:support-fragment:$rootProject.ext.appCompatVersion"
+    testApi 'junit:junit:4.12'
 }
\ No newline at end of file
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index 056c182ff..fbca5679e 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -107,6 +107,7 @@ android {
         signedRelease {
             initWith release
             signingConfig = signingConfigs.release
+            matchingFallbacks = ['release']
         }
         debug {
             applicationIdSuffix ".debug"
@@ -155,12 +156,12 @@ android {
         variant.mergedFlavor.versionCode = variant.productFlavors.get(0).versionCode * 10000000 + defaultConfig.versionCode + variant.productFlavors.get(1).versionCode
 
         //Custom APK name
-        variant.outputs.each { output ->
+        variant.outputs.all { output ->
             def outputName = "VLC-Android-"
             if (variant.productFlavors.get(0).name != "vanilla")
                 outputName += variant.productFlavors.get(0).name.toUpperCase() + "-"
             outputName += variant.versionName + "-" + variant.productFlavors.get(1).name + ".apk"
-            output.outputFile = new File(output.outputFile.parentFile, outputName);
+            outputFileName = outputName
         }
     }
 
@@ -194,18 +195,18 @@ task generateSources (type: Jar) {
 }
 
 dependencies {
-    compile project(':libvlc')
-    compile project(':medialibrary')
-    compile project(':api')
-    compile project(':axmlrpc')
-    compile "com.android.support:recyclerview-v7:$rootProject.ext.appCompatVersion"
-    compile "com.android.support:design:$rootProject.ext.appCompatVersion"
-    compile "com.android.support:support-annotations:$rootProject.ext.appCompatVersion"
-    compile "com.android.support:preference-v7:$rootProject.ext.appCompatVersion"
-    compile "com.android.support:leanback-v17:$rootProject.ext.appCompatVersion"
-    compile "com.android.support:preference-leanback-v17:$rootProject.ext.appCompatVersion"
-    compile "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintLayoutVersion"
-    testCompile 'junit:junit:4.12'
+    implementation project(':libvlc')
+    implementation project(':medialibrary')
+    implementation project(':api')
+    implementation project(':axmlrpc')
+    implementation "com.android.support:recyclerview-v7:$rootProject.ext.appCompatVersion"
+    implementation "com.android.support:design:$rootProject.ext.appCompatVersion"
+    implementation "com.android.support:support-annotations:$rootProject.ext.appCompatVersion"
+    implementation "com.android.support:preference-v7:$rootProject.ext.appCompatVersion"
+    implementation "com.android.support:leanback-v17:$rootProject.ext.appCompatVersion"
+    implementation "com.android.support:preference-leanback-v17:$rootProject.ext.appCompatVersion"
+    implementation "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintLayoutVersion"
+    testImplementation 'junit:junit:4.12'
 }
 
 static def buildTime() {



More information about the Android mailing list