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 is failing after upgrading the react native version to 0.75.2 #46319

Open
aashish-tanwar opened this issue Sep 4, 2024 · 5 comments
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications.

Comments

@aashish-tanwar
Copy link

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
@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Sep 4, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ 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 react-native-bot added the Platform: Android Android applications. label Sep 4, 2024
@react-native-bot
Copy link
Collaborator

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:

@deepanshushuklad11
Copy link
Contributor

@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 :)

@catarinadasilva
Copy link

catarinadasilva commented Sep 10, 2024

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

@cortinico
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Platform: Android Android applications.
Projects
None yet
Development

No branches or pull requests

5 participants