当前位置: 首页 > 知识库问答 >
问题:

错误:无法解析android studio 3.4中的依赖关系

江正德
2023-03-14
ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.cursoradapter:cursoradapter:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve androidx.drawerlayout:drawerlayout:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.cursoradapter:cursoradapter:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve androidx.drawerlayout:drawerlayout:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.cursoradapter:cursoradapter:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve androidx.drawerlayout:drawerlayout:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve androidx.cursoradapter:cursoradapter:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve androidx.drawerlayout:drawerlayout:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve androidx.cursoradapter:cursoradapter:1.0.0.
Show Details
Affected Modules: app


ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve androidx.drawerlayout:drawerlayout:1.0.0.
Show Details
Affected Modules: app

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs"
apply plugin: 'com.apollographql.android'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "********"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
    implementation 'com.google.android.material:material:1.1.0-alpha05'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0-alpha01'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0-alpha04'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

    //Apollo
    implementation 'com.apollographql.apollo:apollo-runtime:1.0.0-alpha5'
    implementation 'com.apollographql.apollo:apollo-http-cache:1.0.0-alpha5'
    implementation "com.apollographql.apollo:apollo-coroutine-support:1.0.0-alpha5"

    //okhttp3
    implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'

    //Anko
    implementation "org.jetbrains.anko:anko:$anko_version"
    implementation "org.jetbrains.anko:anko-design:$anko_version"

    //Dependency injection
    implementation 'com.google.dagger:dagger:2.16'
    kapt 'com.google.dagger:dagger-compiler:2.16'

    //Room
    implementation "androidx.room:room-runtime:2.1.0-alpha06"
    implementation "androidx.room:room-coroutines:2.1.0-alpha04"
    kapt "androidx.room:room-compiler:2.1.0-alpha06"

    implementation "androidx.lifecycle:lifecycle-extensions:2.1.0-alpha04"
    implementation "androidx.paging:paging-runtime-ktx:2.1.0"

    //Coroutines
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
    implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'

    //Navigation
    implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"
    implementation "android.arch.navigation:navigation-ui-ktx:1.0.0"

    //Fresco - Image Loader.
    implementation 'com.facebook.fresco:fresco:1.12.1'

    //Maps and Location
    implementation "com.google.android.gms:play-services-location:16.0.0"
    implementation "com.google.android.gms:play-services-maps:16.1.0"

    //Preference
    implementation "androidx.preference:preference:1.0.0"

    //Multidex
    implementation 'androidx.multidex:multidex:2.0.1'

    //Google Ads
    implementation 'com.google.android.gms:play-services-ads:17.2.0'

    //ImagePicker.
    implementation 'com.github.nguyenhoanglam:ImagePicker:1.3.1'
}

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

buildscript {
    ext {
        anko_version = '0.10.8'
        kotlin_version = '1.3.30'
    }

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0"
        classpath 'com.apollographql.apollo:apollo-gradle-plugin:1.0.0-alpha5'

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

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { //For coroutine support
            url 'http://dl.bintray.com/apollographql/android'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我该怎么解决

共有1个答案

危彬彬
2023-03-14

我通过在gradle-wrapper.properties中恢复distributionUrl来解决我的问题

distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

回到

distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

并在build中恢复gradle依赖项。gradle从

classpath 'com.android.tools.build:gradle:3.4.0'

回到

classpath 'com.android.tools.build:gradle:3.3.2'
 类似资料:
  • 我使用的是Maven 3.1.1。当我运行时,我收到以下错误: 我的< code>pom.xml是:

  • 我对Android的Gradle构建有问题。我尝试了很多方法来解决这个问题,但没有什么不起作用。我需要帮助。 Gradle版本:4.4 Gradle插件:3.0.1 错误:无法解析app@serverDebug /compileClasspath的依赖关系:无法解析项目:vksdk_library。 错误:无法解析“”的依存关系:app@mockDebugAndroidTest/compileCl

  • 我已经在pom中配置了本地maven存储库。xml。当我构建项目时,它会显示依赖项下载错误(请参阅下面的日志)。Maven正在尝试从我的本地Maven存储库下载所有依赖项。 日志 这是我的pom。xml文件 本地存储库是http://XXX。XXX。XX。XXX:8081/artifactory/libs本地发布 xml。背景

  • 12月8日,我开始在运行一个Android项目(使用Flatter框架创建)时遇到问题,该项目已经发布到Google Play上,在编译之前从未出现过问题。 我得到的错误如下: 所以我开始挖掘,发现我最近的变化不是问题所在。Bintray下载中心似乎是12月1日的日落(google.Bintray.com) 由于我使用的是一些Firebase软件包的旧版本,因此此链接似乎已关闭,现在我无法编译我的

  • 我创建了一个新的android项目,它在build上显示错误 我试了一下已有的答案 无法解析:com.android.support:AppCompat-v7 24.0.1 我尝试使android Studio无效并重新启动 错误:无法解析“:app@DebugAndroidTest/CompileClasspath”得依赖项:无法解析JUnit:JUnit:4.12. 错误:无法解析“:app@

  • 我有一个奇怪的问题,< code > mvn clean install-d project . version = 1 或< code>jenkins build运行正常,但当我在IDE中打开模块时,intellij变得非常愤怒,这影响了开发。 我在intellij日志中看到以下问题 POM 代码受版权保护,所以不能透露,但这是一个基本大纲 < li>fabric-common:基本模块(用于绑