Closed cabhara closed 2 years ago
I think you need to upgrade your app's compileSdkVersion
to 31 because androidx.core:core:1.7.0
(which ExoPlayer depends on) has a minCompileSdk
version of 31.
Forcing minCompileSdk with 31 is rather not solution here especially due to known Cast framework issues on Android 12.
As a workaround you can add in build.gradle:
android {
...
defaultConfig {
configurations.all {
resolutionStrategy {
force "androidx.core:core:1.6.0"
force "androidx.core:core-ktx:1.6.0"
}
}
...
}
Just to clarify - setting the compileSdkVersion
is different from the targetSdkVersion
and is only relevant for accessing the latest methods and should have no influence on the resulting app.
I set the minCompileSdk to 31. Now I get the error:
Task :app:mergeDebugJavaResource FAILED
FAILURE: Build failed with an exception.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade More than one file was found with OS independent path 'META-INF/annotation-experimental_release.kotlin_module'.
This sounds like a generic gradle dependency problem where two of your app dependencies include the same file. Unfortunately we can't help you with that unless it's related to ExoPlayer and you are probably better off asking on StackOverflow or similar sites.
I guess I will use exoplayer 2.15.1 for now, with that it compiles ok. Hope the google IMA example code will work with that. Thanks.
Closing the issue for now as this seems to be an app specific gradle issue.
I set the minCompileSdk to 31. Now I get the error:
Task :app:mergeDebugJavaResource FAILED
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app:mergeDebugJavaResource'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade More than one file was found with OS independent path 'META-INF/annotation-experimental_release.kotlin_module'.
@cabhara I encountered this same build error with two separate projects of mine, even though we don't use the IMA extension (we use the IMA SDK standalone). I think the source of the issue is actually the new IMA sdk v3.25.1, which the ExoPlayer IMA extension library just internally upgraded to in ExoPlayer v2.16.0.
Because of that, I can trigger this error in three different ways:
I was able to resolve the build errors by upgrading our Android Gradle Plugin from v4.2.2 to v7.0.4 and changing our Java compilation version from Java 8 to Java 11.
@tonihei Although its not explicitly stated, Java 11 compilation seems to be required for IMA v3.25.1 -- see the sample build.gradle file here https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side.
I think the ExoPlayer docs need to be updated to reflect that in one of these two places:
I don't think Java 11 is needed by either IMA or ExoPlayer's IMA extension. IMA only added this configuration to their demo app (and the linked guide) because Android Studio's Gradle plugin version 7.0.0 and above requires Gradle to run with Java 11 for compilation (which is also the default in Android Studio since Arctic Fox). They don't actually have to declare this in their gradle file with targetCompatibility JavaVersion.VERSION_11
, as you can verify by removing these lines from their sample app.
I just tested ad playback with ExoPlayer 2.16.1 (and IMA 3.25.1) in a clean app that builds using Java 8 and has only targetCompatibility JavaVersion.VERSION_1_8
defined, and everything is working just fine.
More than one file was found with OS independent path 'META-INF/annotation-experimental_release.kotlin_module'
I encountered the same problem, which you can fix by adding packagingOptions { exclude("META-INF/*.kotlin_module") }
to your gradle project.
Thank you for the explanation!
Not sure if that is intended, but my Android Studio project (based on Java 1.8) won't compile with
implementation 'com.google.android.exoplayer:extension-ima:2.16.0'
It works for 2.15.1 and below.
(I'm implementing the IMA player code from https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side into an existing Java project)
from the error listing: