From f66322adc74abbee0fd1e446bc2de8b9e0f1e402 Mon Sep 17 00:00:00 2001
From: Goooler <wangzongler@gmail.com>
Date: Fri, 21 Jan 2022 17:09:18 +0800
Subject: [PATCH] Adopt AGP 4.2+

---
 application/app/build.gradle             | 12 +++---------
 application/donations/build.gradle       |  6 +++---
 application/live-plot-graph/build.gradle |  6 +++---
 application/mediadb/build.gradle         |  6 +++---
 application/moviepedia/build.gradle      |  6 +++---
 application/resources/build.gradle       |  4 ++--
 application/television/build.gradle      |  6 +++---
 application/tools/build.gradle           |  6 +++---
 application/vlc-android/build.gradle     |  6 +++---
 build.gradle                             |  3 +--
 extension-api/build.gradle               |  4 ++--
 gradle.properties                        |  2 +-
 libvlc/build.gradle                      |  6 +++---
 medialibrary/build.gradle                |  6 +++---
 14 files changed, 36 insertions(+), 43 deletions(-)

diff --git a/application/app/build.gradle b/application/app/build.gradle
index 9594d60c04..aa1d26388d 100644
--- a/application/app/build.gradle
+++ b/application/app/build.gradle
@@ -24,17 +24,11 @@ android {
         pickFirst 'lib/x86_64/libc++_shared.so'
     }
 
-    dexOptions {
-        maxProcessCount 8
-        javaMaxHeapSize "4g"
-        preDexLibraries true
-    }
-
     dataBinding {
         enabled = true
     }
 
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
 
     flavorDimensions "abi"
 
@@ -46,8 +40,8 @@ android {
 
     defaultConfig {
         applicationId rootProject.ext.appId
-        minSdkVersion rootProject.ext.minSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
+        minSdk rootProject.ext.minSdkVersion
+        targetSdk rootProject.ext.targetSdkVersion
         versionCode rootProject.ext.versionCode
         versionName rootProject.ext.versionName
         vectorDrawables.useSupportLibrary = true
diff --git a/application/donations/build.gradle b/application/donations/build.gradle
index 228dc09537..f3ab415867 100644
--- a/application/donations/build.gradle
+++ b/application/donations/build.gradle
@@ -27,7 +27,7 @@ apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-android-extensions'
 
 android {
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
 
     dataBinding {
         enabled = true
@@ -38,8 +38,8 @@ android {
     }
 
     defaultConfig {
-        minSdkVersion rootProject.ext.minSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
+        minSdk rootProject.ext.minSdkVersion
+        targetSdk rootProject.ext.targetSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles 'consumer-rules.pro'
diff --git a/application/live-plot-graph/build.gradle b/application/live-plot-graph/build.gradle
index 6a961f50e0..7697fc53cd 100644
--- a/application/live-plot-graph/build.gradle
+++ b/application/live-plot-graph/build.gradle
@@ -26,11 +26,11 @@ apply plugin: 'com.android.library'
 apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-android-extensions'
 android {
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
 
     defaultConfig {
-        minSdkVersion rootProject.ext.minSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
+        minSdk rootProject.ext.minSdkVersion
+        targetSdk rootProject.ext.targetSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles 'consumer-rules.pro'
diff --git a/application/mediadb/build.gradle b/application/mediadb/build.gradle
index 702e562fa9..07c92e8f72 100644
--- a/application/mediadb/build.gradle
+++ b/application/mediadb/build.gradle
@@ -26,7 +26,7 @@ apply plugin: 'com.android.library'
 apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-kapt'
 android {
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
 
     kotlinOptions.jvmTarget = "1.8"
 
@@ -35,8 +35,8 @@ android {
     }
 
     defaultConfig {
-        minSdkVersion rootProject.ext.minSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
+        minSdk rootProject.ext.minSdkVersion
+        targetSdk rootProject.ext.targetSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles 'consumer-rules.pro'
diff --git a/application/moviepedia/build.gradle b/application/moviepedia/build.gradle
index 528b3b9c84..a3fa183b42 100644
--- a/application/moviepedia/build.gradle
+++ b/application/moviepedia/build.gradle
@@ -4,7 +4,7 @@ apply plugin: 'kotlin-kapt'
 apply plugin: 'kotlin-android-extensions'
 
 android {
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
 
     kotlinOptions.jvmTarget = "1.8"
 
@@ -17,8 +17,8 @@ android {
     }
 
     defaultConfig {
-        minSdkVersion rootProject.ext.minSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
+        minSdk rootProject.ext.minSdkVersion
+        targetSdk rootProject.ext.targetSdkVersion
         buildConfigField 'int', 'VLC_VERSION_CODE', "${rootProject.ext.versionCode}"
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
diff --git a/application/resources/build.gradle b/application/resources/build.gradle
index 798c0f2be2..58475147e8 100644
--- a/application/resources/build.gradle
+++ b/application/resources/build.gradle
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-android-extensions'
 
 android {
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
 
     kotlinOptions.jvmTarget = "1.8"
 
@@ -12,7 +12,7 @@ android {
     }
 
     defaultConfig {
-        minSdkVersion rootProject.ext.minSdkVersion
+        minSdk rootProject.ext.minSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         buildConfigField "String", "APP_ID", "\"${rootProject.ext.appId}\""
diff --git a/application/television/build.gradle b/application/television/build.gradle
index c2d1452be1..cc2da4fb7b 100644
--- a/application/television/build.gradle
+++ b/application/television/build.gradle
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
 apply plugin: 'kotlin-kapt'
 apply plugin: 'kotlin-android-extensions'
 android {
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
 
     packagingOptions {
         pickFirst '**/*.so'
@@ -20,8 +20,8 @@ android {
     dataBinding.enabled = true
 
     defaultConfig {
-        minSdkVersion rootProject.ext.minSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
+        minSdk rootProject.ext.minSdkVersion
+        targetSdk rootProject.ext.targetSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
         consumerProguardFiles 'consumer-rules.pro'
diff --git a/application/tools/build.gradle b/application/tools/build.gradle
index 019e65913c..ee5abccfab 100644
--- a/application/tools/build.gradle
+++ b/application/tools/build.gradle
@@ -2,13 +2,13 @@ apply plugin: 'com.android.library'
 apply plugin: 'kotlin-android'
 
 android {
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
 
     kotlinOptions.jvmTarget = "1.8"
 
     defaultConfig {
-        minSdkVersion rootProject.ext.minSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
+        minSdk rootProject.ext.minSdkVersion
+        targetSdk rootProject.ext.targetSdkVersion
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 
diff --git a/application/vlc-android/build.gradle b/application/vlc-android/build.gradle
index a2e43fe99a..d64f24321b 100644
--- a/application/vlc-android/build.gradle
+++ b/application/vlc-android/build.gradle
@@ -7,7 +7,7 @@ android {
 
     kotlinOptions.jvmTarget = "1.8"
 
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
 
     dataBinding {
         enabled = true
@@ -37,8 +37,8 @@ android {
         // that the app's state is completely cleared between tests.
         testInstrumentationRunnerArguments clearPackageData: 'true'
 
-        minSdkVersion rootProject.ext.minSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
+        minSdk rootProject.ext.minSdkVersion
+        targetSdk rootProject.ext.targetSdkVersion
         vectorDrawables.useSupportLibrary = true
 
         javaCompileOptions {
diff --git a/build.gradle b/build.gradle
index 6a09896d24..587ebf9962 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,5 @@
 // Top-level build file where you can add configuration options common to all sub-projects/modules.
 buildscript {
-    ext.android_plugin_version = '7.0.4'
     ext.kotlin_version = '1.4.31'
     ext.kotlinx_version = '1.4.1'
     repositories {
@@ -10,7 +9,7 @@ buildscript {
         mavenLocal()
    }
     dependencies {
-        classpath "com.android.tools.build:gradle:$android_plugin_version"
+        classpath "com.android.tools.build:gradle:7.0.4"
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
         classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
         classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2'
diff --git a/extension-api/build.gradle b/extension-api/build.gradle
index e866d86b6f..0d143b4640 100644
--- a/extension-api/build.gradle
+++ b/extension-api/build.gradle
@@ -34,10 +34,10 @@ ext {
 }
 
 android {
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
 
     defaultConfig {
-        minSdkVersion rootProject.ext.minSdkVersion
+        minSdk rootProject.ext.minSdkVersion
     }
     buildTypes {
         release {
diff --git a/gradle.properties b/gradle.properties
index 717b48a616..ae33bd5ce4 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -4,7 +4,7 @@ android.databinding.incremental=true
 kapt.incremental.apt=true
 kapt.use.worker.api=true
 kapt.include.compile.classpath=false
-org.gradle.jvmargs=-Xms512M -Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+org.gradle.jvmargs=-Xms512M -Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC  -Dfile.encoding=UTF-8
 org.gradle.parallel=true
 
 POM_URL=https://code.videolan.org/videolan/vlc-android/
diff --git a/libvlc/build.gradle b/libvlc/build.gradle
index bcd9146ee7..74e4927c04 100644
--- a/libvlc/build.gradle
+++ b/libvlc/build.gradle
@@ -9,9 +9,9 @@ ext {
 android {
 
     defaultConfig {
-        compileSdkVersion rootProject.ext.compileSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
-        minSdkVersion rootProject.ext.minSdkVersion
+        compileSdk rootProject.ext.compileSdkVersion
+        targetSdk rootProject.ext.targetSdkVersion
+        minSdk rootProject.ext.minSdkVersion
         resValue "string", "build_vlc_revision", vlcRevision()
         tasks.whenTaskAdded { task ->
             if (task.name.startsWith('merge')) {
diff --git a/medialibrary/build.gradle b/medialibrary/build.gradle
index be5a3fc772..3f2937bbc0 100644
--- a/medialibrary/build.gradle
+++ b/medialibrary/build.gradle
@@ -32,10 +32,10 @@ android {
         sourceCompatibility JavaVersion.VERSION_1_8
         targetCompatibility JavaVersion.VERSION_1_8
     }
-    compileSdkVersion rootProject.ext.compileSdkVersion
+    compileSdk rootProject.ext.compileSdkVersion
     defaultConfig {
-        minSdkVersion rootProject.ext.minSdkVersion
-        targetSdkVersion rootProject.ext.targetSdkVersion
+        minSdk rootProject.ext.minSdkVersion
+        targetSdk rootProject.ext.targetSdkVersion
     }
 
     sourceSets {
-- 
GitLab