【问题标题】:Could not find cardview.jar (androidx.cardview:cardview:1.0.0)找不到 cardview.jar (androidx.cardview:cardview:1.0.0)
【发布时间】:2020-02-18 08:07:25
【问题描述】:

我的项目运行良好,但今天我打开它时,出现了这个错误,尽管我没有使用任何 cardview。我的另一个项目构建良好,但只有那个项目没有构建。

找不到cardview.jar (androidx.cardview:cardview:1.0.0)。

我的班级路径是:classpath 'com.android.tools.build:gradle:3.5.1'

我手动添加了 cardview 库,但也没有用。

我已经添加了

maven {
            url "https://maven.google.com"
        }

但它也没有用。

我手动添加了 cardview 库,但也没有用。

这是我的 gradle 代码项目级别

buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'

        // 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 {
            url "https://maven.google.com"
        }
        maven { url 'https://maven.fabric.io/public' }

    }
}

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

这是我的 gradle 代码应用级别

应用插件:'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.intechdev.tcommerce"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'io.reactivex.rxjava2:rxjava:2.1.9'
    implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
    implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
    implementation 'com.squareup.retrofit2:retrofit:2.6.2'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'androidx.exifinterface:exifinterface:1.0.0'
    implementation 'com.github.tiper:MaterialSpinner:1.3.3'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.2.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'
    implementation 'com.mikhaellopez:circularimageview:4.0.2'
    implementation "androidx.preference:preference:1.1.0"
    implementation 'com.android.support:multidex:1.0.3'
    implementation "com.github.bumptech.glide:glide:4.9.0"
    implementation 'com.iarcuschin:simpleratingbar:0.1.5'
    annotationProcessor "com.github.bumptech.glide:compiler:4.9.0"
    implementation "com.github.firdausmaulan:GlideSlider:1.5.1"
    api 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
    implementation 'com.justkiddingbaby:vercodeedittext:1.1.0'
    implementation 'com.google.android.material:material:1.1.0-beta01'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

【问题讨论】:

  • 我添加了这个库,android get error failed to resolve androidx.cardview.cardview:1.0.0
  • 发布您的app/build.gradle 文件
  • 我编辑了我的帖子并添加了gradle文件代码@H.sanati
  • 从 build.gradle 中移除 androidx.cardview:cardview:1.0.0 并在 xml 中使用 <androidx.cardview.widget.CardView。并使用implementation 'com.google.android.material:material:1.0.0'

标签: android android-studio android-cardview androidx materialcardview


【解决方案1】:

只需删除

    implementation "com.github.firdausmaulan:GlideSlider:1.5.1"

并使用另一个滑块库。

【讨论】:

    【解决方案2】:

    您没有添加 CardView 库。

    将此添加到您的依赖项中的新行中:

     implementation 'androidx.cardview:cardview:1.0.0'
    

    然后同步你的 Gradle 文件应该可以解决问题。

    【讨论】:

    • 如果您来自受限制的国家,请确保您已连接 VPN
    • 当我添加此依赖项时,android studio 收到此错误:错误:无法解决:androidx.cardview.cardview:1.0.0: Affected Modules: app.我总是使用 VPN
    【解决方案3】:

    Gradle 版本与您的 Android Studio 版本不兼容。
    在本节中,升级您的 Gradle 版本

    文件 > 项目结构 > 项目

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-09-09
      • 1970-01-01
      • 1970-01-01
      • 2022-11-09
      • 2018-11-06
      • 2018-01-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多