android 项目一导入support v4 包就报错
报错信息如下,确认布局问题没有问题,support v4 jar包以导入:
Process: com.example.demo, PID: 32542
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.demo/com.example.demo.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.v4.widget.DrawerLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2356)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2418)
at android.app.ActivityThread.access$900(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5289)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.support.v4.widget.DrawerLayout
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:757)
at android.view.LayoutInflater.inflate(LayoutInflater.java:482)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:429)
at android.app.Activity.setContentView(Activity.java:2145)
at com.example.demo.MainActivity.onCreate(MainActivity.java:39)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2309)
... 10 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.widget.DrawerLayout" on path: DexPathList[[zip file "/data/app/com.example.demo-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
已解决这个问题,下载了所有的sdk tools 就好了
个人觉得出现这种情况可能会有多种情况:
如果还是不行,参看这个blog:http://blog.csdn.net/huangxiaohu_coder/article/details/8497286