facebook / react-native

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

Could not find com.facebook.fresco.stetho #32944

Closed Rc85 closed 2 years ago

Rc85 commented 2 years ago

Description

* What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find com.facebook.fresco:stetho:2.2.0.
     Searched in the following locations:
       - file:/C:/Users/roger/.m2/repository/com/facebook/fresco/stetho/2.2.0/stetho-2.2.0.pom
       - file:/F:/Projects/my_takeouts/client/mobile/marketplace/node_modules/react-native/android/com/facebook/fresco/stetho/2.2.0/stetho-2.2.0.pom
       - file:/F:/Projects/my_takeouts/client/mobile/marketplace/node_modules/jsc-android/dist/com/facebook/fresco/stetho/2.2.0/stetho-2.2.0.pom
       - https://dl.google.com/dl/android/maven2/com/facebook/fresco/stetho/2.2.0/stetho-2.2.0.pom
       - https://repo.maven.apache.org/maven2/com/facebook/fresco/stetho/2.2.0/stetho-2.2.0.pom
       - https://www.jitpack.io/com/facebook/fresco/stetho/2.2.0/stetho-2.2.0.pom
     Required by:
         project :app > com.facebook.flipper:flipper-fresco-plugin:0.75.1

This only happens when I use mavenCentral in android/build.gradle. Using jcenter is fine. But jcenter is gonna be removed soon.

https://github.com/facebook/flipper/issues/2410

Version

0.66.4

Output of npx react-native info

System:
    OS: Windows 10 10.0.19042
    CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
    Memory: 10.96 GB / 31.93 GB
  Binaries:
    Node: 14.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.11 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK: Not Found
  IDEs:
    Android Studio: Version  4.1.0.0 AI-201.8743.12.41.7042882
    Visual Studio: 15.9.28307.1401 (Visual Studio Community 2017)
  Languages:
    Java: 17.0.1
  npmPackages:
    @react-native-community/cli: Not Found
    react: ^17.0.2 => 17.0.2
    react-native: ^0.66.4 => 0.66.4
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. Use mavenCentral in android/build.gradle
  2. Run app in development

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

android/build.gradle

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

buildscript {
    ext {
        minSdkVersion = 23
        compileSdkVersion = 31
        targetSdkVersion = 31
        ndkVersion = "20.1.5948944"
        googlePlayServicesVersion = "17.0.0"
        kotlinVersion = "1.5.20"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.0.0")
        classpath 'com.google.gms:google-services:4.3.8'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
        // 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()
        mavenCentral()
        maven { url 'https://www.jitpack.io' }
    }
}

android/app.build.gradle (omitted some code)

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "androidx.core:core-splashscreen:1.0.0-alpha02"
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

    implementation platform('com.google.firebase:firebase-bom:28.2.1')
    implementation 'com.facebook.android:facebook-android-sdk:[5,6)'
    implementation 'com.facebook.android:facebook-share:[5,6)'
    implementation 'com.android.support:multidex:2.0.1'

    implementation 'com.google.android.gms:play-services-wallet:19.0.1'
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.implementation
    into 'libs'
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
cortinico commented 2 years ago

What you're experiencing is caused by having a FLIPPER_VERSION=0.75.1 somewhere inside a gradle.proprties inside your project. That Flipper version is really old and you should instead use at least 0.99.0 which is the correct version to use with 0.66.4:

https://github.com/facebook/react-native/blob/1b31d6bb582768ccbe92d3c1a9e43354a8c531e5/template/android/gradle.properties#L28

sapramit commented 2 years ago

Anyone still facing the same issue as it not working for me as well even with FLIPPER_VERSION=0.99.0

cortinico commented 2 years ago

Anyone still facing the same issue as it not working for me as well even with FLIPPER_VERSION=0.99.0

What's the exact error message you're facing?

henrymoulton commented 2 years ago

@cortinico I'm getting this error too across 0.99.0 and 0.138.0

When I rollback to 0.75.1 it's fine?

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-flipper:generateDebugRFile'.
> Could not resolve all files for configuration ':react-native-flipper:debugCompileClasspath'.
   > Could not find com.facebook.flipper:flipper:0.99.0 # https.
     Required by:
         project :react-native-flipper

* 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.
==============================================================================

2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDevDebugAarMetadata'.
> Could not resolve all files for configuration ':app:devDebugRuntimeClasspath'.
   > Could not find com.facebook.flipper:flipper:0.99.0 # https.
     Searched in the following locations:
       - file:/Users/henrymoulton/.m2/repository/com/facebook/flipper/flipper/0.99.0 # https/flipper-0.99.0 # https.pom
       - file:/Users/henrymoulton/Code/app/node_modules/react-native/android/com/facebook/flipper/flipper/0.99.0 # https/flipper-0.99.0 # https.pom
       - file:/Users/henrymoulton/Code/app/node_modules/jsc-android/dist/com/facebook/flipper/flipper/0.99.0 # https/flipper-0.99.0 # https.pom
       - https://dl.google.com/dl/android/maven2/com/facebook/flipper/flipper/0.99.0 # https/flipper-0.99.0 # https.pom
       - https://repo.maven.apache.org/maven2/com/facebook/flipper/flipper/0.99.0 # https/flipper-0.99.0 # https.pom
       - https://jcenter.bintray.com/com/facebook/flipper/flipper/0.99.0 # https/flipper-0.99.0 # https.pom
       - https://www.jitpack.io/com/facebook/flipper/flipper/0.99.0 # https/flipper-0.99.0 # https.pom
       - https://maven.google.com/com/facebook/flipper/flipper/0.99.0 # https/flipper-0.99.0 # https.pom
     Required by:
         project :app
         project :app > project :react-native-flipper
cortinico commented 2 years ago

Not sure what is going on with your setup, but this link is working fine: https://repo.maven.apache.org/maven2/com/facebook/flipper/flipper/0.99.0/ (as Flipper is on Maven Central as expected).

cortinico commented 2 years ago

Closing as there we no follow up, no reproducer, and the provided dependency is verified as available on maven central. Feel free to reopen if the issue persist

wadhia-yash commented 2 years ago

Any status even I am still getting same issue @cortinico

IlkhomKurbanov commented 2 years ago

Same issue, same messages as on henrymoulton's screen

Vashiru commented 2 years ago

@Aarush-wadhia @IlkhomKurbanov I ran into this today as well and it's a good chance that you're actually affected by jCenter going down / being down today: https://status.gradle.com/incidents/9740r6bzx438

I ended up following the steps from here: https://stackoverflow.com/questions/74258160/is-jcenter-down-permanently-31-oct

Which meant adding mavenCentral() before google() and jcenter() in my build.gradle. As well as using patch-package to patch any other packages having jcenter() still in their build.gradle. You also might have to try some different version for the FLIPPER_SDK. I ended up with FLIPPER_VERSION=0.99.0 for react-native 0.65.1.

Note: If you use patch-package, running a gradle sync actualy undoes your changes. You'll have to run yarn install again to have it run as a post-install script and get all your packages in.

jerry-santana commented 1 year ago

Anyone still facing this issue? I haven't been able to fix this for days :(

marcocirillo01 commented 1 year ago

I have already this problem with no solution at this moment, if i solve i will type there

alexjs87 commented 2 months ago

In my case, I solved it by doing this procedure

File android/build.gradle :

buildscript {
    ...
    repositories {
        ...
-        jcenter()
+       maven { url "https://maven.aliyun.com/repository/jcenter" }
    }
}
allprojects {
+   buildscript {
+       repositories {
+           maven { url "https://maven.aliyun.com/repository/jcenter" }
+       }
+   }
    repositories {
        ...
-       jcenter()
+       maven { url "https://maven.aliyun.com/repository/jcenter" }
    }
}
kneeraj1996 commented 1 month ago

In my case, I solved it by doing this procedure

File android/build.gradle :

buildscript {
    ...
    repositories {
        ...
-        jcenter()
+       maven { url "https://maven.aliyun.com/repository/jcenter" }
    }
}
allprojects {
+   buildscript {
+       repositories {
+           maven { url "https://maven.aliyun.com/repository/jcenter" }
+       }
+   }
    repositories {
        ...
-       jcenter()
+       maven { url "https://maven.aliyun.com/repository/jcenter" }
    }
}

This solution worked for me, thank you