react-native-track-player: Could not find com.google.android.exoplayer:exoplayer-core:2.11.4.

Describe the bug Hi I install react native track player on a fresh project and Im getting this error on android only: Could not find com.google.android.exoplayer:exoplayer-core:2.11.4. Searched in the following locations: - https://repo.maven.apache.org/maven2/com/google/android/exoplayer/exoplayer-core/2.11.4/exoplayer-core-2.11.4.pom - https://dl.google.com/dl/android/maven2/com/google/android/exoplayer/exoplayer-core/2.11.4/exoplayer-core-2.11.4.pom - https://www.jitpack.io/com/google/android/exoplayer/exoplayer-core/2.11.4/exoplayer-core-2.11.4.pom

To Reproduce Steps to reproduce the behavior: yarn add react-native-track-player

Environment (please complete the following information): Run react-native info in your project and share the content. System: Binaries: Node: 14.17.5 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.20.6 - /usr/local/bin/npm Watchman: 2021.08.02.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 Android SDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7583922 Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild Languages: Java: 15.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.65.0 => 0.65.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found What react-native-track-player version are you using? 2.0.3 Are you testing on a real device or in the simulator? android emulator Which OS version are you running? MacOs Big Sur

Code I get the error running the app

tried adding different maven url but none work.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 45 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Ok, I have updated the example in the repo to RN 0.65.1 and can confirm the issue.

For now the workaround is to add jcenter() to allprojects { repositories { like I’ve done here: https://github.com/DoubleSymmetry/react-native-track-player/commit/5b3084745a58f81c1e49a5737e300801dc714cd7

The better fix will be to update exoplayer to a version that is released under maven central but that will require some more work. I’ll keep this issue open until then.

As jCenter was removed from react-native v0.65+ and no longer allows package updates, all packages should be obtained from mavenCentral. Thus, I would recommend defining the package such that other dependencies are no longer fetched from jCenter. So it is better to include jCenter dependent modules/groups to android/build.gradle like this:

allprojects {
    repositories {
        ...
        jcenter() {
            content {
                includeGroup("com.google.android.exoplayer")
            }
        }
        ...

    }
}

For who is experiencing compatibility issue regarding exoplayer versions between react-native-track-player and react-native-video, even with includeGroup("com.google.android.exoplayer") in your project’s build.gradle and resolutionStrategy { force 'com.google.android.exoplayer:exoplayer-core:2.11.4' } in app module build.gradle

Check if you’re using also react-native-video@5.2.0. If so and if you don’t need explicitly v5.2.0, downgrade to v5.1.1 until this library will be compatible with exoplayer 2.13.2 (required by react-native-video@5.2.0 and also available in mavenCentral).

Hope it helps someone! ✌🏻

All,

I understand that this is a super frustrating issue to encounter when trying to get new installs or upgrades running. With that said, v2.2.0 (currently in rc with v2.2.0-rc3 fixes this issue. As all the team efforts are going into that release we’re not going to address this issue for v2.1.0.

I know it stinks! But it’s the reality of the situation. The good news is that there is ample information on this issue to help folks find the solution for this issue themselves.

The issue will remain open until v2.2.0 is out of RC at which time it will be closed.

Didn’t realise this got closed. Reopening until it’s fully fixed and not just worked around.

We are working on an update that uses the latest exoplayer and does not reply on jcenter() but it’s not ready yet in the meantime the workaround must be used.

Guys, shouldn’t this be described on lib’s documentation website?

Add jcenter() to allprojects section too

@xeoneux this definitely would be the reason… I thought that might be it but the gradle file @espenjanson posted still has jcenter() in it.

So I was a bit confused. But if jcenter is no longer in the gradle file then that would be the reason.

I’ll have to update the dependency to a version that’s published to maven central.

As jCenter was removed from react-native v0.65+ and no longer allows package updates, all packages should be obtained from mavenCentral. Thus, I would recommend defining the package such that other dependencies are no longer fetched from jCenter. So it is better to include jCenter dependent modules/groups to android/build.gradle like this:

allprojects {
    repositories {
        ...
        jcenter() {
            content {
                includeGroup("com.google.android.exoplayer")
            }
        }
        ...

    }
}

this one help me thank u buddy

@GrimDev we know its an important issue and we’re working on a fix. At the moment using jcenter() is still a valid workaround… You cannot publish new packages there but it is still available as read-only.

In the latest changelog at https://github.com/facebook/react-native/releases/tag/v0.65.0, it mentions: JCenter has been sunsetted and read-only now. We have removed JCenter as a maven repository and updated dependencies to use MavenCentral and Jitpack.

Therefore the new projects do not have jcenter() in the gradle files.

Is that the reason?

@dcvz next os, next issue! Same here, not working for me with react-native 0.65 and android. Exactly the same error message when I try to run ./gradlew bundleRelease