Search code examples
javaandroidreact-nativegradlegradlew

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'. after upgrading to ReactNative 0.71.7


I have recently upgraded my ReactNative application from 0.62.2 to 0.71.7. This is happening now when I'm trying to build my Android application.

I have also ensure my SDK Manager has all the necessary SDK downloaded (using latest Android Studio Flamingo | 2022.2.1 Patch 1) enter image description here

Error message

Error 1: When executing .gradlew build at Android path

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Problems reading data from Binary store in /Users/Username/.gradle/.tmp/gradle8504350670693111797.bin offset 102613 exists? true

Error 2: When sync-ing gradle within Android Studio

No variants found for ':app'. Check build files to ensure at least one variant exists. at:
com.android.tools.idea.gradle.project.sync.AndroidModule.prepare(GradleModules.kt:266)
  com.android.tools.idea.gradle.project.sync.SyncProjectActionWorker.populateAndroidModels(SyncProjectActionWorker.kt:99)

Sample codes that probably matters + my environment

Project's Build gradle

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

buildscript {
    project.ext {
        buildToolsVersion = "30.0.0"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30

        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:7.3.0')
        classpath("com.facebook.react:react-native-gradle-plugin")
        
        // RNFirebase
        classpath 'com.google.gms:google-services:4.3.15'
    }
}

gradle-wrapper.properties

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

Java environment (I tried both, 11 and 15)

#Java 11
java 11.0.10 2021-01-19 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.10+8-LTS-162)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.10+8-LTS-162, mixed mode)

#Java 15
openjdk 15.0.2 2021-01-19
OpenJDK Runtime Environment Corretto-15.0.2.7.1 (build 15.0.2+7)
OpenJDK 64-Bit Server VM Corretto-15.0.2.7.1 (build 15.0.2+7, mixed mode, sharing)

Solution

  • Turns out it was my Firebase Analytics dependency issue which implemented inside app/build.gradle 🙄

    Commented it out, everything run again as expected.

    // implementation 'com.google.firebase:firebase-analytics:17.2.2'