Java 如何解决此错误:包android.support.design.widget不存在?

Java 如何解决此错误:包android.support.design.widget不存在?,java,android,Java,Android,我是Android Studio的新手。。。 我遵循了关于错误的另一个答案:包android.support.design.widget不存在 我应用了这个代码 implementation'com.android.support:design:29.0.2' 在应用程序>build.gradle中。但它不起作用。我怎样才能解决这个问题 这是我的密码 应用程序>build.gradle apply plugin: 'com.android.application' android {

我是Android Studio的新手。。。 我遵循了关于错误的另一个答案:包android.support.design.widget不存在

我应用了这个代码
implementation'com.android.support:design:29.0.2'
在应用程序>build.gradle中。但它不起作用。我怎样才能解决这个问题

这是我的密码

应用程序>build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.myapplication2"
        minSdkVersion 15
        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 'com.android.support:design:29.0.2'`

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.`

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

    task clean(type: Delete) {
        delete rootProject.buildDir
    }
这是build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.example.myapplication2"
        minSdkVersion 15
        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 'com.android.support:design:29.0.2'`

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.`

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

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


您是否尝试过与gradle同步并清除并重建项目?是的,我尝试过,但仍然不起作用…没有设计支持库的第29版。他们都在版本28时切换到androidx。你显然已经在用androidx做其他事情了。只要更新下面的任何示例就可以使用androidx组件。