无法确定任务“:app:lintVitalRelease”的依赖关系。

8

我刚开始学习React Native和Android开发。 目前我想要构建一个APK,但遇到了这个错误。

**失败:构建过程中出现异常。 * 出现了什么问题: 无法确定任务':app:lintVitalRelease'的依赖项。

配置':app:releaseRuntimeClasspath'的所有任务依赖项都无法解析。 无法解析项目 :react-native-cookies。 需要该项目以继续: 项目 :app 无法找到项目 :react-native-cookies 的匹配配置:没有可消耗的配置具有属性。**

在build.gradle文件中:


    release {

      signingConfig signingConfigs.release
       matchingFallbacks = ['release', 'debug'] 
    }
  }


dependencies {
    implementation project(':react-native-cookies')
    implementation project(':react-native-clear-app-cache')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-reanimated')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':react-native-orientation')

}

在 app/build.gradle 文件中。
buildscript {
    ext {
        buildToolsVersion = "28.0.3" //28.0.3
        minSdkVersion = 16
        compileSdkVersion = 28 //28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"


    }

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}


我不知道怎么解决这个问题,因为我已经尝试过修改buildToolsVersion、buildTypes等等。有什么解决办法吗?请帮帮我。


2
我通过以下方式解决了它: ./gradlew clean build --refresh-dependencies - Praneeth Jayarathna
3个回答

1
请将以下内容添加到您的 Build.gradle 文件中:
dependencies {
    def multidex_version = "2.0.1"
    implementation "androidx.multidex:multidex:$multidex_version"
}

并且还要添加这个

  defaultConfig {
        multiDexEnabled true
                }

这将解决您的问题。

最好说明是哪个build.gradle文件,并更具体地指明在文件/部分/任何地方放置东西的位置。 - SEoF

1
检查一下这个。
dependencies {       
    testImplementation 'junit:junit:4.+'
}

在你的 build.gradle(模块)中:

-1
android/app/build.gradle 中替换:
...
androidTestImplementation 'androidx.test:runner:1.2.1' // old
androidTestImplementation 'androidx.test:runner:1.3.0-alpha03' // new
...
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.1' // old
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha03' // new
...


4
原帖作者没有包含这些细节,因此您在这里做出了假设,不一定回答了他的问题。而且,这个问题与“react-native-cookies”软件包的分辨率问题似乎很奇怪,如果您确定这是正确的解决方案,您至少应该解释一下(即使含糊),为什么这是正确的修复方法。 - Samer Murad

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接