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

Android build is failing after upgrading the react native version to 0.75.2

Open aashish-tanwar opened this issue 1 year ago • 5 comments

Description

I'm working on the hybrid app which is built using the React Native Package.

It was working fine on the v0.70.14 version but when I upgraded it to version 0.75.2, the Android project stopped building but the iOS project is building fine.

I'm using Hermes as a JS engine

"react": "18.3.1" "react-native": "0.75.2",

I have upgraded the gradle version as well

dependencies { classpath 'com.android.tools.build:gradle:8.5.0' classpath 'com.google.gms:google-services:4.4.1' classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")

This is my gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists

Steps to reproduce

  1. node node_modules/react-native/cli.js start
  2. The app doesn't get built from Android Studio when I click on Run App button, the screenshot of the issue is attahced.

React Native Version

0.75.2

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.6
  CPU: (8) arm64 Apple M3
  Memory: 148.36 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.16.0
    path: ~/.nvm/versions/node/v20.16.0/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.1
    path: ~/.nvm/versions/node/v20.16.0/bin/npm
  Watchman:
    version: 2024.08.19.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2411.12071903
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 22.0.2
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.2
    wanted: 0.75.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not find com.facebook.react:react-native:0.75.2.
     Required by:
         project :app
         project :app > project :notifee_react-native

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Reproducer

It is a private repository

Screenshots and Videos

Screenshot 2024-09-03 at 9 50 49 PM

aashish-tanwar avatar Sep 04 '24 04:09 aashish-tanwar

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

react-native-bot avatar Sep 04 '24 04:09 react-native-bot

:warning: Missing Reproducible Example
:information_source: We could not detect a reproducible example in your issue report. Please provide either:

react-native-bot avatar Sep 04 '24 04:09 react-native-bot

@aashish-tanwar I believe AGP 8.5.0 requires Gradle 8.0 or later , try changing that combination . Check Compatiblity list Alternative way is to create a sample app with combination of different AGP and Gradle versions, that will scope down your issue . or Provide a Reproducer Template , I will try it :)

deepanshushuklad11 avatar Sep 04 '24 10:09 deepanshushuklad11

I'm having the same issue, switched the react native version to 0.75.2 and added the following:

on android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 33
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "26.1.10909125"
        kotlinVersion = "1.9.24"
    }
...
allprojects {
    repositories {
        exclusiveContent {
           filter {
               includeGroup "com.facebook.react"
           }
           forRepository {
               maven {
                   url "$rootDir/../node_modules/react-native/android"
               }
           }
       }
    }
}

on android/app/build.gradle

react {
    autolinkLibrariesWithApp()
}

on android/settings.gradle

pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }

running npx react-native run-android gives the error above(and bellow)

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not find com.facebook.react:react-android:0.75.2.
     Required by:
         project :app
   > Could not find com.facebook.react:hermes-android:0.75.2.
     Required by:
         project :app

catarinadasilva avatar Sep 10 '24 17:09 catarinadasilva

2. The app doesn't get built from Android Studio when I click on Run App button, the screenshot of the issue is attahced.

@aashish-tanwar are you able to build locally with the CLI before trying Android Studio?

cortinico avatar Sep 12 '24 13:09 cortinico

@aashish-tanwar distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip

TRY GRADLE 8.8 at gradle-wrapper.properties

sahad00 avatar Sep 27 '24 12:09 sahad00

any update for this same issue as well with me

Nejoum-aljazeera avatar Oct 16 '24 18:10 Nejoum-aljazeera

Closing as @aashish-tanwar is unresponsive.

Please don't hijack the issue and open a new one if you still have a similar issue.

cortinico avatar Oct 17 '24 16:10 cortinico