gradle 无法确定任务“:app:compileDebugJavaWithJavac”的依赖项,升级到ReactNative 0.71.7后

m3eecexj  于 2023-05-07  发布在  Java
关注(0)|答案(1)|浏览(378)

我最近将我的ReactNative应用程序从0.62.2升级到0.71.7。当我尝试构建我的Android应用程序时,这种情况就发生了。
我还确保我的SDK管理器已经下载了所有必要的SDK(使用最新的Android Studio Flamingo| 2022.2.1补丁1)

错误信息

错误1:在Android路径下执行.gradlew build

* 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

错误2:在Android Studio中同步gradle时

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)
可能重要的示例代码+我的环境

项目的构建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环境(我试过11和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)
d4so4syb

d4so4syb1#

原来是我的Firebase Analytics依赖性问题在app/build.gradle中实现🙄
评论了一下,一切又如预期的那样运行了。

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

相关问题