Search code examples
androidandroid-appcompatandroid-snackbarsnackbarandroid-studio-2.3

Unable to use Snackbar after updating Android Studio


I have recently updated my Android Studio version to 2.3

I am working on a project now and I've noticed that I am unable to import Snackbar class. I never had that problem before.

I can use it by adding compile 'com.nispok:snackbar:2.6.1' and I can import it then, but I don't think I should have to do that instead of just using Android's android.support.design.widget.Snackbar;

This is are my dependencies from build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}

I have also tried to play around with DataBinding concept in my project but I don't think this could cause that issue?

Thank you.


Solution

  • You are missing the compile 'com.android.support:design:25.2.0' in your dependencies. As the library is not added you are unable to get the Snackbar class.