【问题标题】:Could not determine the dependencies of task ':app:lintVitalRelease'无法确定任务 ':app:lintVitalRelease' 的依赖关系
【发布时间】:2020-07-11 13:01:54
【问题描述】:

我是 react native 和 android 开发的新手。 目前我想构建一个 APK,但我遇到了这个错误。

**FAILURE:构建失败并出现异常。 * 什么地方出了错: 无法确定任务 ':app:lintVitalRelease' 的依赖关系。

无法解析配置“:app:releaseRuntimeClasspath”的所有任务依赖项。 无法解析项目:react-native-cookies。 要求: 项目:应用程序 无法找到项目的匹配配置: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 等。有什么想法可以解决这个问题吗?请帮忙。

【问题讨论】:

  • 我通过 ./gradlew clean build --refresh-dependencies 解决了这个问题

标签: android react-native build.gradle


【解决方案1】:

请将此添加到您的 Build.gradle

dependencies {
    def multidex_version = "2.0.1"
    implementation "androidx.multidex:multidex:$multidex_version"
}

还要添加这个

  defaultConfig {
        multiDexEnabled true
                }

这将解决您的问题

【讨论】:

  • 最好说明是哪个 build.gradle,并更具体地说明将内容放在文件/部分/任何内容中的“位置”
【解决方案2】:

看看这个

dependencies {       
    testImplementation 'junit:junit:4.+'
}

在您的构建中:gradle(模块)

【讨论】:

    【解决方案3】:

    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
    ...
    
    

    【讨论】:

    • 原发帖人没有包含这些细节,所以你在这里做一个假设,不一定回答他的问题。此外,这似乎很奇怪,问题是关于 react-native-cookies 包的分辨率问题,如果您确定这是正确的解决方案,您至少应该解释(即使含糊其辞),为什么这是正确的解决方案跨度>
    猜你喜欢
    • 2021-11-20
    • 1970-01-01
    • 2020-09-17
    • 2020-10-04
    • 2021-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多