Как исправить: ОШИБКА: Не удалось разрешить: 'androidx.cardview: cardview: 1.0.0' - PullRequest
0 голосов
/ 19 апреля 2019

Я разрабатываю новое приложение для Android, используя библиотеки androidx , и мне нужно использовать cardview в моем макете.
, поэтому я пытаюсь добавить библиотеку cardview в свойпроект, но я получаю эту ошибку ERROR: Failed to resolve: cardview

я проверяю ответы Не удалось: com.android.support:cardview-v7:26.0.0 android , но это не помогает мне
ответы, такие как


build.gradle(проект)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.chavosh.porterageapp"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
    testImplementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    testImplementation 'junit:junit:4.12'

    // recycler view
    implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha04'

    implementation 'androidx.cardview:cardview:1.0.0'

}

build.gradle (moudle)

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

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://jitpack.io' }
        maven { url "https://maven.google.com" }
    }
}

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

gradle.properties содержит две строки

android.useAndroidX=true
android.enableJetifier=true

error pic

1 Ответ

2 голосов
/ 19 апреля 2019

Просто удали их!

Только с этими 3 вы можете использовать RecyclerView и CardView, а также плюс: ConstraintLayout

implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
implementation 'androidx.core:core-ktx:1.1.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
...