From d54077366467821c5e117d022fa9d024b7c53f81 Mon Sep 17 00:00:00 2001 From: OxygenCobalt Date: Thu, 27 Jan 2022 19:41:25 -0700 Subject: [PATCH] deps: fix aar issues Fix insane build issues with the new aar system through means that I really don't understand. --- app/build.gradle | 18 ++++++++---------- gradle.properties | 2 ++ prebuild.py | 7 ++++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 32b227449..8ef166e36 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -93,6 +93,14 @@ dependencies { // --- THIRD PARTY --- // Exoplayer + // WARNING: THE EXOPLAYER VERSION MUST BE KEPT IN LOCK-STEP WITH THE CUSTOM AAR BLOBS. + // IF NOT, VERY UNFRIENDLY BUILD FAILURES AND CRASHES MAY ENSUE. + def exoplayerVersion = '2.16.1' + implementation("com.google.android.exoplayer:exoplayer-core:$exoplayerVersion") { + exclude group: "com.google.android.exoplayer", module: "exoplayer-extractor" + } + implementation fileTree(dir: "libs", include: ["library-*.aar"]) + implementation fileTree(dir: "libs", include: ["extension-*.aar"]) // Image loading implementation 'io.coil-kt:coil:2.0.0-alpha06' @@ -104,16 +112,6 @@ dependencies { // Lint ktlint 'com.pinterest:ktlint:0.43.2' - - // WARNING: THE EXOPLAYER VERSION MUST BE KEPT IN LOCK-STEP WITH THE CUSTOM EXTRACTOR AND FLAC - // EXTENSION BLOBS. IF NOT, VERY UNFRIENDLY BUILD FAILURES AND CRASHES MAY ENSUE. - def exoplayer_version = "2.16.1" - implementation("com.google.android.exoplayer:exoplayer-core:$exoplayer_version") { - exclude group: "com.google.android.exoplayer", module: "exoplayer-extractor" - } - - implementation fileTree(dir: "libs", include: ["extension-*.aar"]) - implementation fileTree(dir: "libs", include: ["library-*.aar"]) } task ktlint(type: JavaExec, group: "verification") { diff --git a/gradle.properties b/gradle.properties index 9bb1cb21f..73a41e5ce 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,3 +19,5 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official +# Stop ExoPlayer from mangling AAR libraries with default abstract methods +android.enableDexingArtifactTransform=false \ No newline at end of file diff --git a/prebuild.py b/prebuild.py index e2ccc3d6a..760511db3 100755 --- a/prebuild.py +++ b/prebuild.py @@ -31,10 +31,10 @@ def sh(cmd): sys.exit(1) start_path = os.path.join(os.path.abspath(os.curdir)) -libs_path = os.path.join(start_path, "app", "src", "libs") -exoplayer_path = os.path.join(start_path, "app", "srclibs", "exoplayer") +libs_path = os.path.join(start_path, "app", "libs") +exoplayer_path = os.path.join(start_path, "app", "build", "srclibs", "exoplayer") -if os.path.exists(exoplayer_path): +if os.path.exists(libs_path): reinstall = input(INFO + "info:" + NC + " exoplayer is already installed. would you like to reinstall it? [y/n] ") if not re.match("[yY][eE][sS]|[yY]", reinstall): @@ -99,6 +99,7 @@ os.chdir(exoplayer_path) sh("./gradlew library-extractor:bundleReleaseAar") sh("./gradlew extension-flac:bundleReleaseAar") os.chdir(start_path) +sh("mkdir " + libs_path) sh("cp " + extractor_aar_path + " " + libs_path) sh("cp " + flac_ext_aar_path + " " + libs_path)