From eddc2b0b33f3eaf0c0302ca00b5bde2311b8afe0 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Tue, 26 May 2020 08:49:56 +0100 Subject: [PATCH] Enable multidex for demos This is necessary now we have Guava in debug (no-minified) apps. Also switch to AndroidX multidex to remove the support library dependency. Temporarily we need to add an Application class, as internal jetification doesn't seem to handle declaring MultiDexApplication in AndroidManifest.xml. issue:#7421 PiperOrigin-RevId: 313145023 --- constants.gradle | 1 + demos/cast/build.gradle | 2 ++ .../exoplayer2/castdemo/DemoApplication.java | 23 +++++++++++++++++++ demos/main/build.gradle | 2 ++ .../exoplayer2/demo/DemoApplication.java | 4 ++-- extensions/ima/build.gradle | 2 +- 6 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 demos/cast/src/main/java/com/google/android/exoplayer2/castdemo/DemoApplication.java diff --git a/constants.gradle b/constants.gradle index b0a0e4fce5..852da69b07 100644 --- a/constants.gradle +++ b/constants.gradle @@ -31,6 +31,7 @@ project.ext { androidxAppCompatVersion = '1.1.0' androidxCollectionVersion = '1.1.0' androidxMediaVersion = '1.0.1' + androidxMultidexVersion = '2.0.0' androidxTestCoreVersion = '1.2.0' androidxTestJUnitVersion = '1.1.1' androidxTestRunnerVersion = '1.2.0' diff --git a/demos/cast/build.gradle b/demos/cast/build.gradle index c929f09c87..b26112e15a 100644 --- a/demos/cast/build.gradle +++ b/demos/cast/build.gradle @@ -27,6 +27,7 @@ android { versionCode project.ext.releaseVersionCode minSdkVersion project.ext.minSdkVersion targetSdkVersion project.ext.appTargetSdkVersion + multiDexEnabled true } buildTypes { @@ -57,6 +58,7 @@ dependencies { implementation project(modulePrefix + 'library-ui') implementation project(modulePrefix + 'extension-cast') implementation 'androidx.appcompat:appcompat:' + androidxAppCompatVersion + implementation 'androidx.multidex:multidex:' + androidxMultidexVersion implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'com.google.android.material:material:1.1.0' } diff --git a/demos/cast/src/main/java/com/google/android/exoplayer2/castdemo/DemoApplication.java b/demos/cast/src/main/java/com/google/android/exoplayer2/castdemo/DemoApplication.java new file mode 100644 index 0000000000..f2d2288b6a --- /dev/null +++ b/demos/cast/src/main/java/com/google/android/exoplayer2/castdemo/DemoApplication.java @@ -0,0 +1,23 @@ +/* + * Copyright 2020 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.android.exoplayer2.castdemo; + +import androidx.multidex.MultiDexApplication; + +// Note: Multidex is enabled in code not AndroidManifest.xml because the internal build system +// doesn't dejetify MultiDexApplication in AndroidManifest.xml. +/** Application for multidex support. */ +public final class DemoApplication extends MultiDexApplication {} diff --git a/demos/main/build.gradle b/demos/main/build.gradle index b7a8666fe3..f26fd7dc32 100644 --- a/demos/main/build.gradle +++ b/demos/main/build.gradle @@ -27,6 +27,7 @@ android { versionCode project.ext.releaseVersionCode minSdkVersion project.ext.minSdkVersion targetSdkVersion project.ext.appTargetSdkVersion + multiDexEnabled true } buildTypes { @@ -64,6 +65,7 @@ android { dependencies { implementation 'androidx.annotation:annotation:' + androidxAnnotationVersion implementation 'androidx.appcompat:appcompat:' + androidxAppCompatVersion + implementation 'androidx.multidex:multidex:' + androidxMultidexVersion implementation 'com.google.android.material:material:1.1.0' implementation project(modulePrefix + 'library-core') implementation project(modulePrefix + 'library-dash') diff --git a/demos/main/src/main/java/com/google/android/exoplayer2/demo/DemoApplication.java b/demos/main/src/main/java/com/google/android/exoplayer2/demo/DemoApplication.java index c36d370992..86978a1613 100644 --- a/demos/main/src/main/java/com/google/android/exoplayer2/demo/DemoApplication.java +++ b/demos/main/src/main/java/com/google/android/exoplayer2/demo/DemoApplication.java @@ -15,7 +15,7 @@ */ package com.google.android.exoplayer2.demo; -import android.app.Application; +import androidx.multidex.MultiDexApplication; import com.google.android.exoplayer2.DefaultRenderersFactory; import com.google.android.exoplayer2.RenderersFactory; import com.google.android.exoplayer2.database.DatabaseProvider; @@ -40,7 +40,7 @@ import java.io.IOException; /** * Placeholder application to facilitate overriding Application methods for debugging and testing. */ -public class DemoApplication extends Application { +public class DemoApplication extends MultiDexApplication { public static final String DOWNLOAD_NOTIFICATION_CHANNEL_ID = "download_channel"; diff --git a/extensions/ima/build.gradle b/extensions/ima/build.gradle index f25a26b3a9..28f201e24b 100644 --- a/extensions/ima/build.gradle +++ b/extensions/ima/build.gradle @@ -45,9 +45,9 @@ dependencies { implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0' compileOnly 'org.jetbrains.kotlin:kotlin-annotations-jvm:' + kotlinAnnotationsVersion androidTestImplementation project(modulePrefix + 'testutils') + androidTestImplementation 'androidx.multidex:multidex:' + androidxMultidexVersion androidTestImplementation 'androidx.test:rules:' + androidxTestRulesVersion androidTestImplementation 'androidx.test:runner:' + androidxTestRunnerVersion - androidTestImplementation 'com.android.support:multidex:1.0.3' androidTestCompileOnly 'org.checkerframework:checker-qual:' + checkerframeworkVersion testImplementation project(modulePrefix + 'testutils') testImplementation 'com.google.guava:guava:' + guavaVersion