chenzhongpu
chenzhongpu

Reputation: 6871

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

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?

Upvotes: 6

Views: 7470

Answers (1)

dhiku
dhiku

Reputation: 1858

Try this.

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

Upvotes: 2

Related Questions