unable to load import android.support.design.widget.BottomNavigationView; on android studio

本秂侑毒 提交于 2020-01-16 08:36:07

问题


I want to make navigation view from this tutorial tutor but I found a problem

cannot resolve design

ive read a lot similar question from stack overflow but that doesnt help me, ive tried to invaled chaces/restartd ive treid to rescyn gradle ive treid to delet libraries inside .idea still not work heres my gradle


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'
}

heres how I import it in my MainActivity

import android.support.design.widget.BottomNavigationView;

thank you so much


回答1:


Your dependency is mixed of support library and AndroidX which is not right. Refactor it to AndroidX using Android Studio and remove duplicate dependency.

Refactor > Migrate to AndroidX and press Do Refactor



来源:https://stackoverflow.com/questions/58471771/unable-to-load-import-android-support-design-widget-bottomnavigationview-on-and

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!