Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android studio : android.support.v4.widget.DrawerLayout could not be found

Tags:

android

After importing the demo from http://developer.android.com/training/implementing-navigation/nav-drawer.html, the android studio automatically makes it Gradle-configured . At first, it's dependency part in build.gradle:

dependencies {
    compile 'com.android.support:+'

}

And the above causes error.

Followed the solution (Manifest merger failed : uses-sdk:minSdkVersion 14), I change it to

dependencies {
    compile 'com.android.support:support-v4:20.0.0'

}

and it works. Then I can build and run the app.

However, the code shows 'cannot resolve symbol R ‘, 'cannot resolve symbol DrawerLayout' and so on. And I then found errors in activity_main.xml:

android.support.v4.widget.DrawerLayout could not be found

I have specify the dependency of android.support.v4 , and why the drawerlayout cannot be found?

like image 771
chenzhongpu Avatar asked Oct 14 '14 14:10

chenzhongpu


1 Answers

Try this.

compile 'com.android.support:support-v4:21.0.3'

like image 165
dhiku Avatar answered Nov 13 '22 20:11

dhiku