1

我正在编写一个新的应用程序并且我正在使用AndroidX它,因为它似乎是从现在开始的最佳方式。

我在尝试聚在一起时遇到了一些麻烦MDCAndroidX尽管我没有使用任何旧的支持库依赖项,但我不断收到有关android.support.v4.*命名空间的错误。

这些是我的级别build.gradle

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

buildscript {

    ext {
        constraintLayoutVersion = '1.1.2'
        androidxVersion = '1.0.0-rc01'
        drawerlayoutVersion = '1.0.0-alpha1'
        espressoVersion = '3.1.0-alpha1'
        gradleVersion = '3.1.4'
        junitVersion = '4.12'
        kotlinVersion = '1.2.61'
        lifecycleVersion = '2.0.0-rc01'
        navigationVersion = '1.0.0-alpha05'
        roomVersion = '2.0.0-rc01'
        runnerVersion = '1.1.0-alpha1'
    }

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:$gradleVersion"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

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

我的模块级别build.gradle

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 28
    dataBinding {
        enabled = true
    }
    defaultConfig {
        applicationId "com.example.goodold.openartmap"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "0.0.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            applicationIdSuffix ".debug"
            debuggable true
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation "androidx.core:core-ktx:$rootProject.androidxVersion" //Support Library
    implementation "androidx.fragment:fragment-ktx:$rootProject.androidxVersion" //KTX Fragments
    implementation "androidx.appcompat:appcompat:$rootProject.androidxVersion"
    implementation "androidx.recyclerview:recyclerview:$rootProject.androidxVersion"
    implementation "com.google.android.material:material:$rootProject.androidxVersion"
    //Material Design Library

    implementation "androidx.room:room-runtime:$rootProject.roomVersion" // Room components
    kapt "androidx.room:room-compiler:$rootProject.roomVersion"

    implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycleVersion"
    // LiveData + ViewModel
    kapt "androidx.lifecycle:lifecycle-compiler:$rootProject.lifecycleVersion"

    implementation "androidx.drawerlayout:drawerlayout:$rootProject.drawerlayoutVersion"
    implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion"

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$rootProject.kotlinVersion"

    testImplementation "junit:junit:$rootProject.junitVersion"
    androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"
    androidTestImplementation "androidx.test:runner:$rootProject.runnerVersion"
    androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion"
}

我的gradle.properties

org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enableJetifier=true

我错过了什么?

4

0 回答 0