HowTo #2 - Depend on a local checkout of ExoPlayer
Adding a dependency to your application’s
build.gradle file is the easiest way to depend on released versions of ExoPlayer, but what if you want to depend on the development branch or a version that you’ve modified locally? We’ve made some changes to ExoPlayer’s
dev-v2 branch that make this much easier.
If you haven’t already done so, you’ll need to get a local copy of the ExoPlayer source code:
git clone https://github.com/google/ExoPlayer.git
You can put this anywhere on your machine; there’s no requirement for it to be located in a certain place relative to the Android projects that are going to be using it.
Next, checkout the branch or tag of ExoPlayer that you want to use. At the time of writing only the
dev-v2 branch supports the approach being described here, and so we’ll go ahead and checkout that branch:
git checkout dev-v2
We now have a local copy of ExoPlayer. To depend on it from your own Android project, open your project’s
settings.gradle file and add the following:
gradle.ext.exoplayerRoot = 'path/to/exoplayer'
gradle.ext.exoplayerModulePrefix = 'exoplayer-'
apply from: new File(
In Android Studio you’ll see that all of ExoPlayer’s modules have been added to your project view, making it easy to dive in, inspect and edit the source code. The
exoplayerModulePrefix variable is the prefix attached to the ExoPlayer module names in your project, and can be changed to another prefix if you prefer.
Now that ExoPlayer’s modules are included in your project, you can depend on them as you would on any other local module, for example:
And that’s all there is to it!
The approach described above can currently only be used with the
dev-v2 branch, however it will be available for use with the
release-v2 branch from the
2.5.0 release. It will also work with with release tags from that release.
We hope these changes will make it much easier for developers to use ExoPlayer’s development branch, and to develop application and ExoPlayer changes alongside one another.