facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.16k stars 24.32k forks source link

Could not find any matches for com.facebook.react:react-native:+ as no versions of com.facebook.react:react-native are available. #35845

Closed yanel777 closed 1 year ago

yanel777 commented 1 year ago

New Version

0.71.0, 0.71.0-rc.3 (tried both)

Old Version

0.68.5

Build Target(s)

android development debug

Output of react-native info

System: OS: macOS 12.6 CPU: (10) arm64 Apple M1 Pro Memory: 129.95 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.10.0 - /opt/homebrew/bin/node Yarn: Not Found npm: 8.19.2 - /opt/homebrew/bin/npm Watchman: 2022.10.03.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1 Android SDK: API Levels: 28, 29, 30, 31, 32, 33 Build Tools: 28.0.3, 30.0.2, 31.0.0, 32.0.0, 32.1.0, 33.0.0, 33.0.1 System Images: android-30 | Google Play ARM 64 v8a, android-33 | Google APIs ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9014738 Xcode: 14.1/14B5033e - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /opt/homebrew/opt/openjdk@11/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.0-rc.3 => 0.71.0-rc.3 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Issue and Reproduction Steps

./gradlew installDevelopmentDebug

FAILURE: Build failed with an exception.

this error fail for all libraries

cortinico commented 1 year ago

react-native: 0.71.0-rc.3 => 0.71.0-rc.3

You say you're on 0.71.0 but your environment info says you're on 0.71.0-rc.3 Can you please confirm on which version are you? Plus can you provide a reproducer of this bug?

github-actions[bot] commented 1 year ago
:warning: Missing Reproducible Example
:information_source: It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.
robinlindhout commented 1 year ago

We have the same issue

yanel777 commented 1 year ago

react-native: 0.71.0-rc.3 => 0.71.0-rc.3

You say you're on 0.71.0 but your environment info says you're on 0.71.0-rc.3 Can you please confirm on which version are you? Plus can you provide a reproducer of this bug?

sorry. same issue on 0.71.0 and 0.71.0-rc.3 I have tried both

cortinico commented 1 year ago

I'm looking for a repro at this stage as I can't help further

jguipi commented 1 year ago

same issues on my side

indyteo commented 1 year ago

Hello, I ran into the same issue after upgrading to RN 0.71 and I found a workaround that worked for me:

However, this warning (shown when building) makes me feel this will break soon...

##############################

Using react.gradle in your project is deprecated! You should move to "apply plugin: com.facebook.react"
react.gradle is going to be removed in a future React Native project and your project will not build anymore.
You can use the template as a reference:
https://github.com/facebook/react-native/blob/main/template/android/app/build.gradle

##############################

Maybe we can completely replace the android/app/build.gradle file by this one, I didn't tested it because...

cortinico commented 1 year ago

However, this warning (shown when building) makes me feel this will break soon...

The warning is there because you're still importing react.gradle which you should not. If you follow the upgrade helper you'll see that you have to use apply plugin: com.facebook.react

dmg46664 commented 1 year ago

@cortinico I'm hitting a similar issue although probably not the same (message slightly different). However my question applies to both. Is there a way of getting the build to expand out what the dependency graph can see and the places it does check? Surely that would mean individuals can help narrow the problem themselves in the future?

dmg46664 commented 1 year ago

I found a thread to pull on at least. I think this hint should be in the error message as it isn't obvious: https://stackoverflow.com/questions/42596358/how-to-enable-stacktrace-react-native-run-android-command

cortinico commented 1 year ago

@cortinico I'm hitting a similar issue although probably not the same (message slightly different).

@dmg46664 then please open a separate issue, share a reproducer and your environment. This issue is pending feedback from @yanel777. You can get an overview of your dependency tree if you run cd android && ./gradlew :app:assembleDebug --scan and check the Gradle Scan that gets produced.

Danushka96 commented 1 year ago

https://react-native-community.github.io/upgrade-helper/?from=0.68.5&to=0.71.0 Update the package.json and app/build.gradle file according to the changes

Mmferry commented 1 year ago

I have same error with react native v0.69.6

github-actions[bot] commented 1 year ago

This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.

DeVoresyah commented 1 year ago

I also facing same issue, but for my case I think it's because this library react-native-mmkv-storage

Error:

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find any matches for com.facebook.react:react-android:+ as no versions of com.facebook.react:react-android are available.
     Searched in the following locations:
       - file:/Users/cryptokun/Documents/react-native/MuloApp/node_modules/react-native/android/com/facebook/react/react-android/maven-metadata.xml
       - file:/Users/cryptokun/Documents/react-native/MuloApp/node_modules/jsc-android/dist/com/facebook/react/react-android/maven-metadata.xml
       - https://dl.google.com/dl/android/maven2/com/facebook/react/react-android/maven-metadata.xml
       - https://www.jitpack.io/com/facebook/react/react-android/maven-metadata.xml
     Required by:
         project :app > project :react-native-mmkv-storage
cortinico commented 1 year ago

I also facing same issue, but for my case I think it's because this library react-native-mmkv-storage

Closing as this kind of issues are related to specific libraries. You can find which library is causing the issue in the error message like here:

 Required by:
    project :app > project :react-native-mmkv-storage

Please re-open if you believe this is a bug in React Native core.

AkhileshManda commented 1 year ago

@DeVoresyah I am facing the same issue, did you end up finding up a solution?

DeVoresyah commented 1 year ago

@DeVoresyah I am facing the same issue, did you end up finding up a solution?

yes by upgrading the react-native version into 0.71.6

franznkemaka commented 1 year ago

I also facing same issue, but for my case I think it's because this library react-native-mmkv-storage

Error:

* What went wrong:
Could not determine the dependencies of task ':app:processDebugResources'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
   > Could not find any matches for com.facebook.react:react-android:+ as no versions of com.facebook.react:react-android are available.
     Searched in the following locations:
       - file:/Users/cryptokun/Documents/react-native/MuloApp/node_modules/react-native/android/com/facebook/react/react-android/maven-metadata.xml
       - file:/Users/cryptokun/Documents/react-native/MuloApp/node_modules/jsc-android/dist/com/facebook/react/react-android/maven-metadata.xml
       - https://dl.google.com/dl/android/maven2/com/facebook/react/react-android/maven-metadata.xml
       - https://www.jitpack.io/com/facebook/react/react-android/maven-metadata.xml
     Required by:
         project :app > project :react-native-mmkv-storage

I just faced the same issues,

it turns out React Native MMKV Storage > 2.5.1 isn't compatible with React Native below 0.71

Checkout the breaking changes: https://github.com/mrousavy/react-native-mmkv/releases

fatemehmarzoughi commented 1 year ago

I have also faced the same problem react-native: 0.71.8 and I have added apply plugin: "com.facebook.react" to app/build.gradle and getting this error:

* What went wrong:
A problem occurred evaluating project ':app'.
> Plugin with id 'com.facebook.react' not found.

I appreciate any help 🙏

hanafnafs commented 1 year ago

I have also faced the same problem react-native: 0.71.8 and I have added apply plugin: "com.facebook.react" to app/build.gradle and getting this error:

* What went wrong:
A problem occurred evaluating project ':app'.
> Plugin with id 'com.facebook.react' not found.

I appreciate any help 🙏

Same happened with me, any updates regarding this?

delki8 commented 1 year ago

I'm upgrading from react-native 0.70.0 to 0.71.0.

First I was getting a Could not get unknown property 'hermesEnabled' for project ':app' of type org.gradle.api.Project. which was 'fixed' adding hermesEnabled=true to gradle.properties.

Then I started seeing the Could not find any matches for com.facebook.react:react-native:+ as no versions of com.facebook.react:react-native are available. to fix it I added the plugin: "com.facebook.react" to app/build.gradle

What I'm now seeing is this > Plugin with id 'com.facebook.react' not found. which I'm not sure how to fix.

flyskywhy commented 1 year ago

My RN 0.64.3 APP fixed it ref to https://stackoverflow.com/a/76521278/6318705

omri81 commented 1 year ago

I'm upgrading from react-native 0.70.0 to 0.71.0.

First I was getting a Could not get unknown property 'hermesEnabled' for project ':app' of type org.gradle.api.Project. which was 'fixed' adding hermesEnabled=true to gradle.properties.

Then I started seeing the Could not find any matches for com.facebook.react:react-native:+ as no versions of com.facebook.react:react-native are available. to fix it I added the plugin: "com.facebook.react" to app/build.gradle

What I'm now seeing is this > Plugin with id 'com.facebook.react' not found. which I'm not sure how to fix.

found any solution for this? facing the same issue

delki8 commented 1 year ago

@omri81 try this: https://github.com/facebook/react-native/issues/36234#issuecomment-1439770679. Not sure if that was my solution but it's the closest I can get to whatever worked for me.

nabilfreeman commented 7 months ago

I had this error, and it was because I screwed up my gradle config.

I did this:

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")

            // I pasted some stuff here
        }
    }
}

Instead of:

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 {
            // I should have pasted it here in a separate maven { block
        }
    }
}