4

I cloned ExoPlayer locally and added the modules to my existing project using my settings.gradle as described in the documentation:

gradle.ext.exoplayerRoot = 'path/to/exoplayer' gradle.ext.exoplayerModulePrefix = 'exoplayer-' apply from: new File(gradle.ext.exoplayerRoot, 'core_settings.gradle') 

Whenever I try to build the project, I receive the following build error:

error: package android.support.annotation does not exist

These happen for all @NonNull and @Nullable annotations in the ExoPlayer modules.

I created a new project in Android Studio 3.2.1, added AndroidX support in my gradle.properties file and updated my build.gradle file accordingly.

build.gradle

android { compileSdkVersion 28 defaultConfig { minSdkVersion 26 targetSdkVersion 28 versionCode 1 versionName "1.0" } dataBinding { enabled = true } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) //ExoPlayer implementation project(':exoplayer-library-core') } 

gradle.properties

org.gradle.jvmargs=-Xmx1536m android.databinding.enableV2=true android.useAndroidX=true android.enableJetifier=true 

If I understand correctly, Jetifier should be able to resolve and convert the support dependencies to AndroidX dependencies, but this does not seem to be the case for these local modules.

1 Answer 1

2

I managed to solve the issue by specifying a gradle.properties file for every local exoplayer module in my project that is used in the application. I still don't know what causes the issue, but preventing Jetifier from migrating to AndroidX for the local modules seems to solve this issue.

# Local module Gradle settings. android.useAndroidX=false # Jetifier will convert support libraries of all your dependencies to AndroidX automatically, # if you don't set it true then your project will have both support android.enableJetifier=false 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.