无法加载导入android.support.design.widget.BottomNavigationView;在android studio上

问题描述 投票:0回答:1

我想从本教程tutor中创建导航视图,但发现问题

cannot resolve design

我从堆栈溢出中读取了很多类似的问题,但这并没有帮助我,我尝试过使用chaces / restartd ive treid来重新编码ive treid以删除.idea内部的库。这是我的摇篮


android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.lordbramasta.praktikum"
        minSdkVersion 16
        targetSdkVersion 28
        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.0.2'
//    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'com.android.support:appcompat-v7:28.0.+'
    implementation 'com.android.support:support-v4:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
//    androidTestImplementation 'com.android.test.ext:junit:1.1.0'
//    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.google.android.material:material:1.0.0-rc01'


    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}

这里是我在MainActivity中导入它的方式

import android.support.design.widget.BottomNavigationView;

非常感谢

android android-studio android-fragments
1个回答
1
投票

您的依赖项混合了支持库和AndroidX,这是不对的。 Refactor使用Android Studio到AndroidX,并删除重复的依赖项。

Refactor>迁移到AndroidX,然后按Do Refactor

© www.soinside.com 2019 - 2024. All rights reserved.