2014-10-14 43 views
6

Sau khi nhập bản demo từ http://developer.android.com/training/implementing-navigation/nav-drawer.html, các Android Studio tự động làm cho nó Gradle cấu hình. Lúc đầu, nó phụ thuộc một phần trong build.gradle:Android studio: android.support.v4.widget.DrawerLayout không thể tìm được

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

} 

Và lỗi nguyên nhân trên.

Tiếp theo các giải pháp (Manifest merger failed : uses-sdk:minSdkVersion 14), tôi thay đổi nó để

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

} 

và nó hoạt động. Sau đó, tôi có thể xây dựng và chạy ứng dụng.

Tuy nhiên, mã hiển thị 'biểu tượng không thể giải quyết R', 'không thể phân giải biểu tượng DrawerLayout' và cứ tiếp tục như vậy. Và tôi sau đó phát hiện sai sót trong activity_main.xml:

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

Tôi có chỉ định sự phụ thuộc của android.support.v4, và tại sao DrawerLayout không thể được tìm thấy?

Trả lời

2

Hãy thử điều này.

biên dịch 'com.android.support:support-v4:21.0.3'

Các vấn đề liên quan