Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android build fails in 0.71.0-rc.0 with "Could not find com.facebook.react:react-native:0.71.0-rc.0" #35279

Closed
louiszawadzki opened this issue Nov 9, 2022 · 19 comments
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer

Comments

@louiszawadzki
Copy link
Contributor

Description

I'm trying to test the new release candidate.
I've created a new app, but when trying to start the app on Android, I get the following error (output of yarn android --variant=release yields more info:

* What went wrong:
Could not determine the dependencies of task ':app:mergeDexRelease'.
> Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
   > Could not find com.facebook.react:react-native:0.71.0-rc.0.
     Searched in the following locations:
       - file:/Users/me/RN0710RC0/node_modules/react-native/android/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0.pom
       - file:/Users/me/RN0710RC0/node_modules/jsc-android/dist/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0.pom
       - https://repo.maven.apache.org/maven2/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0.pom
       - https://dl.google.com/dl/android/maven2/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0.pom
       - https://www.jitpack.io/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0.pom
       - https://oss.sonatype.org/content/repositories/snapshots/com/facebook/react/react-native/0.71.0-rc.0/react-native-0.71.0-rc.0.pom
     Required by:
         project :app
   > Could not find com.facebook.react:hermes-engine:0.71.0-rc.0.
     Searched in the following locations:
       - file:/Users/me/RN0710RC0/node_modules/react-native/android/com/facebook/react/hermes-engine/0.71.0-rc.0/hermes-engine-0.71.0-rc.0.pom
       - file:/Users/me/RN0710RC0/node_modules/jsc-android/dist/com/facebook/react/hermes-engine/0.71.0-rc.0/hermes-engine-0.71.0-rc.0.pom
       - https://repo.maven.apache.org/maven2/com/facebook/react/hermes-engine/0.71.0-rc.0/hermes-engine-0.71.0-rc.0.pom
       - https://dl.google.com/dl/android/maven2/com/facebook/react/hermes-engine/0.71.0-rc.0/hermes-engine-0.71.0-rc.0.pom
       - https://www.jitpack.io/com/facebook/react/hermes-engine/0.71.0-rc.0/hermes-engine-0.71.0-rc.0.pom
       - https://oss.sonatype.org/content/repositories/snapshots/com/facebook/react/hermes-engine/0.71.0-rc.0/hermes-engine-0.71.0-rc.0.pom
     Required by:
         project :app

Also on https://repo.maven.apache.org/maven2/com/facebook/react/react-native/, I see "0.71.0-rc.0" but clicking on it returns a 404.

Is there something I am missing to be able to test the new release candidate?

Version

0.71.0-rc.0

Output of npx react-native info

System:
    OS: macOS 12.6.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 26.56 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.11.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - ~/.npm-global/bin/yarn
    npm: 8.19.2 - /opt/homebrew/bin/npm
    Watchman: 2022.10.24.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: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9014738
    Xcode: 14.1/14B47b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.0-rc.0 => 0.71.0-rc.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

npx react-native init RN0710RC0 --version 0.71.0-rc.0
cd RN0710RC0
yarn android

Snack, code example, screenshot, or link to a repository

I put the result of a newly created project here: https://github.com/louiszawadzki/RN0710RC0

@Adnan-Bacic
Copy link
Contributor

maybe related to this? #35210

@louiszawadzki
Copy link
Contributor Author

@Adnan-Bacic I think that's related, both are because React Android is supposed to be published on Maven from what I understand.
However it seems to me that #35210 is dedicated to versions below 0.71, and does not mention anything on how to test the release candidate.

@kelset
Copy link
Contributor

kelset commented Nov 9, 2022

yeah so the reason is that we got SonarType to remove (less than 24hrs ago) the 0.71 artifacts from Maven Central, to avoid any further issues and bring back the situation as it was before for the ecosystem. We are writing up now how to test Android for 0.71 RC0 now that the maven artifacts for it don't exist anymore on maven central, we'll post those instructions both in the reactwg/react-native-releases#41 and in the release notes https://github.com/facebook/react-native/releases/tag/v0.71.0-rc.0

( cc @cipolleschi )

@cipolleschi
Copy link
Contributor

I updated the instructions in both the links shared by @kelset.

A disclaimer note: my cache is still good, so I'm still able to run Android with the standard flow. If someone can confirm that those instructions are actually working, it would be gold! Thank you so much. 🙇

@kelset
Copy link
Contributor

kelset commented Nov 9, 2022

(for context: the maven caches will take around 24hrs to clean, so we are waiting before announcing more broadly the removal of the artifacts since they might still be alive for some folks)

@louiszawadzki
Copy link
Contributor Author

Hi @cipolleschi @kelset, thanks for your quick help!

I think you need to update the links to maven-local.zip in both release and discussion - it links to https://github.com/facebook/react-native/blob/v0.71.0-rc.0 which shows a 404 to me. However there is a link at the bottom of the release (https://github.com/facebook/react-native/releases/download/v0.71.0-rc.0/maven-local.zip) which works ;)

After that I was able to start my app with the steps you provided :)

Feel free to close this issue once the links are updated

@cipolleschi
Copy link
Contributor

Thanks for the feedback and the double-check! Will update the links and close the discussion!

@louiszawadzki
Copy link
Contributor Author

One last thing about libraries, when I add react-native libraries that have the line

implementation 'com.facebook.react:react-native:+'

in their build.gradle (like https://github.com/DataDog/dd-sdk-reactnative I'm working on), I get the following error when building for Android:

Could not determine the dependencies of task ':datadog_mobile-react-native:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':datadog_mobile-react-native:debugCompileClasspath'.
   > Could not find any matches for com.facebook.react:react-native:+ as no versions of com.facebook.react:react-native are available.
     Required by:
         project :datadog_mobile-react-native

Is it something due to the use of the maven-local or is it supposed to be fixed in a next 0.71 RC?

Tell me if you think this needs a new issue, I can open it :)

@kelset
Copy link
Contributor

kelset commented Nov 9, 2022

yeah it's expected because you'll have to move away from that dep; read more of the state of libraries here: reactwg/react-native-releases#41

Once Nicola is back we'll figure out the migration path for libraries

@Libero793
Copy link

Hey Guys,

i think im experiencing and error that is also related to this, but on RN 0.65.3 - so the latest patch for 0.65

Could not find any matches for com.facebook.react:hermes-engine:0.65.+ as no versions of com.facebook.react:hermes-engine are available.

It seems like there is no hermes version vailabel for this RN Version from my perspective? Would be super happy if someone could help out with that

@louiszawadzki
Copy link
Contributor Author

One last thing about libraries, when I add react-native libraries that have the line

implementation 'com.facebook.react:react-native:+'

in their build.gradle (like https://github.com/DataDog/dd-sdk-reactnative I'm working on), I get the following error when building for Android:

Could not determine the dependencies of task ':datadog_mobile-react-native:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':datadog_mobile-react-native:debugCompileClasspath'.
   > Could not find any matches for com.facebook.react:react-native:+ as no versions of com.facebook.react:react-native are available.
     Required by:
         project :datadog_mobile-react-native

Is it something due to the use of the maven-local or is it supposed to be fixed in a next 0.71 RC?

Tell me if you think this needs a new issue, I can open it :)

cross-posting the solution from reactwg/react-native-releases#41 (reply in thread):

before running yarn android, in android/build.gradle, add the following repository inside the allprojects > repositories closure:

        maven {
            url(project.getProperties().get("REACT_NATIVE_MAVEN_LOCAL_REPO"))
        }

@cortinico
Copy link
Contributor

Just a heads up that we released 0.71.0-rc1 which should work fine, without having to specify any workaround or download any artifacts manually

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer and removed Needs: Triage 🔍 labels Nov 23, 2022
@varemenos
Copy link

varemenos commented Nov 24, 2022

I just upgraded to RC1 and tried to run an android app I'm developing locally. One of the dependencies it has is the community async storage (@react-native-async-storage/async-storage), does the library need to adapt to the new changes or was RC1 supposed to fix the issue for the libs too?

Could not determine the dependencies of task ':react-native-async-storage_async-storage:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':react-native-async-storage_async-storage:debugCompileClasspath'.
   > Could not find any matches for com.facebook.react:react-native:+ as no versions of com.facebook.react:react-native are available.
     Required by:
         project :react-native-async-storage_async-storage

I assume this is related because it can't match com.facebook.react:react-native:+ but I'm not 100% sure.

@kelset
Copy link
Contributor

kelset commented Nov 24, 2022

@varemenos libraries will need to adapt to some of the changes coming with 0.71, we're having direct conversations with some key maintainers to setup a migration story for everyone to use, we hope to have it ready ~RC3

@cortinico
Copy link
Contributor

Thanks for flagging this @varemenos. As @kelset mentioned, we're looking into those kind of issues right now. They'll be fixed in RC3

@fvalles
Copy link

fvalles commented Jan 23, 2023

Hi there! I am trying to update my RNative version to 0.70.6 and I am facing a similar issue to the one described in this thread. I have tried downgrading the version to 0.70.5 but I still have the same error:

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:
       - https://dl.google.com/dl/android/maven2/com/facebook/react/react-android/maven-metadata.xml
       - https://maven.google.com/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

In my android/build.gradle I have the following:

allprojects {
  repositories {
    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")
    }
    mavenCentral {
      // We don't want to fetch react-native from Maven Central as there are
      // older versions over there.
      content {
        excludeGroup "com.facebook.react"
      }
    }

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

and under dependencies in android/app/build.gradle:

implementation "com.facebook.react:react-native:+"

I also tried updating the react-native-mmkv version to 2.6.1 but the error still arises...

Does anyone know what the error could be here? Any help would be really appreciated!

@fencer-yd
Copy link

Hi there! I am trying to update my RNative version to 0.70.6 and I am facing a similar issue to the one described in this thread. I have tried downgrading the version to 0.70.5 but I still have the same error:

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:
       - https://dl.google.com/dl/android/maven2/com/facebook/react/react-android/maven-metadata.xml
       - https://maven.google.com/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

In my android/build.gradle I have the following:

allprojects {
  repositories {
    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")
    }
    mavenCentral {
      // We don't want to fetch react-native from Maven Central as there are
      // older versions over there.
      content {
        excludeGroup "com.facebook.react"
      }
    }

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

and under dependencies in android/app/build.gradle:

implementation "com.facebook.react:react-native:+"

I also tried updating the react-native-mmkv version to 2.6.1 but the error still arises...

Does anyone know what the error could be here? Any help would be really appreciated!

The mmkv2.6+ version needs to rely on react-native71 or above, so it is still necessary to control the mmkv version to 2.5

@fvalles
Copy link

fvalles commented Jan 29, 2023

Hi there! I am trying to update my RNative version to 0.70.6 and I am facing a similar issue to the one described in this thread. I have tried downgrading the version to 0.70.5 but I still have the same error:

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:
       - https://dl.google.com/dl/android/maven2/com/facebook/react/react-android/maven-metadata.xml
       - https://maven.google.com/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

In my android/build.gradle I have the following:

allprojects {
  repositories {
    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")
    }
    mavenCentral {
      // We don't want to fetch react-native from Maven Central as there are
      // older versions over there.
      content {
        excludeGroup "com.facebook.react"
      }
    }

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

and under dependencies in android/app/build.gradle:
implementation "com.facebook.react:react-native:+"
I also tried updating the react-native-mmkv version to 2.6.1 but the error still arises...
Does anyone know what the error could be here? Any help would be really appreciated!

The mmkv2.6+ version needs to rely on react-native71 or above, so it is still necessary to control the mmkv version to 2.5

A few hours after I posted a question here I found this useful thread (react-native-mmkv/issues/500) where I understood that the solution was downgrading mmkv library to version 2.5 because 2.6+ works for react native version 0.71+

Thanks anyway for your help fencer!

@flaming-streamz
Copy link

@fencer - sure this helped a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android Android applications. Resolution: Answered When the issue is resolved with a simple answer
Projects
None yet
Development

No branches or pull requests