react-native-track-player icon indicating copy to clipboard operation
react-native-track-player copied to clipboard

Could not find com.google.android.exoplayer:exoplayer-core:2.11.4.

Open giorodri0584 opened this issue 2 years ago • 44 comments

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.

giorodri0584 avatar Aug 19 '21 23:08 giorodri0584

Do you also get this issue when running the example?

dcvz avatar Aug 20 '21 07:08 dcvz

Same issue here with fresh project.

Tucker2015 avatar Aug 20 '21 08:08 Tucker2015

I have just tried to make a new project and add the lib and it has worked. These are the commands I used:

npx react-native init TestProject --template react-native-template-typescript
cd TestProject
yarn add react-native-track-player
yarn run android

dcvz avatar Aug 20 '21 10:08 dcvz

I have just tried to make a new project and add the lib and it has worked. These are the commands I used:

npx react-native init TestProject --template react-native-template-typescript
cd TestProject
yarn add react-native-track-player
yarn run android

Thanks that worked ok.

Tucker2015 avatar Aug 20 '21 11:08 Tucker2015

@giorodri0584 I haven't heard from you yet. Can you try the above?

dcvz avatar Aug 20 '21 12:08 dcvz

@giorodri0584 I haven't heard from you yet. Can you try the abov

@giorodri0584 I haven't heard from you yet. Can you try the above?

At work right now. I'll try it when I get a chance and let you know. Thanks for the quick response

giorodri0584 avatar Aug 20 '21 12:08 giorodri0584

@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

espenjanson avatar Aug 20 '21 18:08 espenjanson

FYI, npx npx react-native init TestProject --template react-native-template-typescript does not create a react-native project with 0.65.1 but rather 0.64.2(?) (I found this out bugfixing my ios issue)

espenjanson avatar Aug 20 '21 18:08 espenjanson

@espenjanson does it work when you follow the commands in my comment above? My guess is your project is not including one of the important repositories. Like maven central.

Although perhaps it's the other way around.. I'll take a look more carefully now that you point out that the commands I used don't generate a 0.65 project.

How are you creating a new project?

dcvz avatar Aug 20 '21 18:08 dcvz

@espenjanson can you post the contents of your gradle file in your Android project?

dcvz avatar Aug 20 '21 18:08 dcvz

Sure!

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "29.0.3"
        minSdkVersion = 25
        compileSdkVersion = 29
        targetSdkVersion = 29
        ndkVersion = "21.4.7075529"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.1.0")
        classpath('com.google.gms:google-services:4.3.3')
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}

espenjanson avatar Aug 20 '21 18:08 espenjanson

@espenjanson if you try the commands I mentioned above (which does not use 0.65) does it run for you?

There must be some difference in the gradle files across versions. I'm not at my computer atm though to check.

dcvz avatar Aug 20 '21 18:08 dcvz

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?

xeoneux avatar Aug 20 '21 18:08 xeoneux

@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.

dcvz avatar Aug 20 '21 18:08 dcvz

Haha, sorry @dcvz my bad there, I actually just included jcenter() instead of mavenCentral() - however, it's still not building for me. Not sure if it's because of track-player though since there seems to be plenty of libraries hit hard by 0.65, I'm currently stuck because of react-native-reanimated (I think).

espenjanson avatar Aug 20 '21 18:08 espenjanson

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.

dcvz avatar Aug 20 '21 19:08 dcvz

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: 5b30847

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.

Thanks a lot. It is working now.

giorodri0584 avatar Aug 21 '21 00:08 giorodri0584

@dcvz I can confirm having the same issue and adding jcenter fixes the issue. Also running RN 0.65.1.

neoassyrian avatar Sep 11 '21 17:09 neoassyrian

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.

dcvz avatar Sep 16 '21 21:09 dcvz

@dcvz Do you know that we are not able to compile our app anymore while this is not fixed ? It is a critical issue. Is there any workaround (calling jcenter() won't work anymore), or quick fix ?

GrimDev avatar Sep 20 '21 14:09 GrimDev

@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.

dcvz avatar Sep 20 '21 19:09 dcvz

@GrimDev As far as I know there's nothing wrong with doing this (yet?)

repositories { mavenLocal() mavenCentral() jcenter() google()

}

espenjanson avatar Sep 20 '21 20:09 espenjanson

I guess jcenter was down when I tried last time, it seems to work today, sorry for the warn

GrimDev avatar Sep 21 '21 07:09 GrimDev

Any updates? Have same issue...

SNNikitin avatar Sep 24 '21 13:09 SNNikitin

@espenjanson can you post the contents of your gradle file in your Android project?

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: 5b30847

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.

Thanks a lot sir. I stuck with this several day :) 💯

Have you any plans to move to maven or something else to avoid the jcenter-related riscs?

SNNikitin avatar Sep 27 '21 08:09 SNNikitin

@SNNikitin please take the time to look through the thread. This question has been answered. We're working on it.

dcvz avatar Sep 27 '21 08:09 dcvz

Thanks for your answer! :) I'm just slightly frustrated, please sorry!

SNNikitin avatar Sep 27 '21 08:09 SNNikitin

Please put this information in the README.md

It took me hours to find this issue, I would still be looking if I didn't sort all the issues in the repo by most comments.

ozturkkl avatar Oct 22 '21 23:10 ozturkkl

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: 5b30847

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.

Well I did this added jcenter() to my build.gradle and tried this on a fresh project but I am still getting the same error can anyone please help as soon as I install react-native-track-player my application fails to build. It would mean a lot thank you.

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 899 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
> Task :app:checkDebugAarMetadata FAILED
5 actionable tasks: 2 executed, 3 up-to-date
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01  
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01      
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > 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
       - file:/C:/Users/bbwha/.m2/repository/com/google/android/exoplayer/exoplayer-core/2.11.4/exoplayer-core-2.11.4.pom
       - file:/C:/Users/bbwha/Downloads/Documents/project/node_modules/react-native/android/com/google/android/exoplayer/exoplayer-core/2.11.4/exoplayer-core-2.11.4.pom
       - file:/C:/Users/bbwha/Downloads/Documents/project/node_modules/jsc-android/dist/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
     Required by:
         project :app > project :react-native-track-player

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 17s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > 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
       - file:/C:/Users/bbwha/.m2/repository/com/google/android/exoplayer/exoplayer-core/2.11.4/exoplayer-core-2.11.4.pom
       - file:/C:/Users/bbwha/Downloads/Documents/project/node_modules/react-native/android/com/google/android/exoplayer/exoplayer-core/2.11.4/exoplayer-core-2.11.4.pom
       - file:/C:/Users/bbwha/Downloads/Documents/project/node_modules/jsc-android/dist/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
     Required by:
         project :app > project :react-native-track-player

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 17s

    at makeError (C:\Users\bbwha\Downloads\Documents\project\node_modules\execa\index.js:174:9)
    at C:\Users\bbwha\Downloads\Documents\project\node_modules\execa\index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async runOnAllDevices (C:\Users\bbwha\Downloads\Documents\project\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:106:5)
    at async Command.handleAction (C:\Users\bbwha\Downloads\Documents\project\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.

Build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        ndkVersion = "21.4.7075529"
    }
    repositories {
        google()
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.2.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        maven { url 'https://www.jitpack.io' }
    }
}

bhavyagosai avatar Oct 31 '21 13:10 bhavyagosai