[英]DrawerLayout - ClassNotFoundException while compiling with Android Studio and Gradle
I was trying to create a sample app using the new DrawerLayout with the Android Studio and Gradle. 我试图使用Android Studio和Gradle的新DrawerLayout创建一个示例应用程序。 I am referring the official google document mentioned here .
我指的是这里提到的官方谷歌文件。 But whenever I launch the app, it exits with an exception (ClassNotFoundException - DrawerLayout).
但每当我启动应用程序时,它都会以异常(ClassNotFoundException - DrawerLayout)退出。
I have installed the latest support library from SDK manager (support-v4-13.0.0.jar) and it's automatically added to dependencies by the IDE. 我已经从SDK管理器(support-v4-13.0.0.jar)安装了最新的支持库,它会自动添加到IDE的依赖项中。 I tried copying this jar to the libs folder of project and changed the reference in the Libraries in "Project Structure".
我尝试将此jar复制到项目的libs文件夹,并在“项目结构”中更改了库中的引用。 But still getting the error.
但仍然得到错误。
Here is the "dependencies" section from my build.gradle 这是我的build.gradle中的“依赖项”部分
dependencies { compile 'com.android.support:support-v4:13.0.+' }
What I am missing here? 我在这里缺少什么?
Thanks. 谢谢。
This was a little weird, but I could figure it out. 这有点奇怪,但我可以搞清楚。
I Just replaced the inclusion of DrawerLayout in the layout XML from 我刚刚在布局XML中替换了DrawerLayout的包含
<DrawerLayout> .... </DrawerLayout>
to 至
<android.support.v4.widget.DrawerLayout> ... </android.support.v4.widget.DrawerLayout>
And this fixed the issue. 这解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.