xiaoliuzi_0_0
xiaoliuzi_0_0
采纳率83.3%
2016-03-22 07:55

使用viewpager报这个错是怎么回事

已采纳

这个是包的什么问题。。。。

 03-22 03:49:15.368: E/AndroidRuntime(1612): FATAL EXCEPTION: main
03-22 03:49:15.368: E/AndroidRuntime(1612): Process: com.example.hospitalmain, PID: 1612
03-22 03:49:15.368: E/AndroidRuntime(1612): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hospitalmain/com.example.hospitalmain.MainActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class android.support.v4.View.ViewPager
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.os.Handler.dispatchMessage(Handler.java:102)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.os.Looper.loop(Looper.java:136)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.app.ActivityThread.main(ActivityThread.java:5001)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at java.lang.reflect.Method.invokeNative(Native Method)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at java.lang.reflect.Method.invoke(Method.java:515)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at dalvik.system.NativeStart.main(Native Method)
03-22 03:49:15.368: E/AndroidRuntime(1612): Caused by: android.view.InflateException: Binary XML file line #8: Error inflating class android.support.v4.View.ViewPager
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.app.Activity.setContentView(Activity.java:1929)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at com.example.hospitalmain.MainActivity.onCreate(MainActivity.java:13)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.app.Activity.performCreate(Activity.java:5231)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
03-22 03:49:15.368: E/AndroidRuntime(1612):     ... 11 more
03-22 03:49:15.368: E/AndroidRuntime(1612): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.View.ViewPager" on path: DexPathList[[zip file "/data/app/com.example.hospitalmain-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.hospitalmain-1, /system/lib]]
03-22 03:49:15.368: E/AndroidRuntime(1612):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.view.LayoutInflater.createView(LayoutInflater.java:559)
03-22 03:49:15.368: E/AndroidRuntime(1612):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
03-22 03:49:15.368: E/AndroidRuntime(1612):     ... 21 more
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • bdmh bdmh 5年前

    布局渲染出错,确认是否存在android.support.v4.View.ViewPager包,或者检查你用的是android.support.v4.View.ViewPager还是Android默认的viewpager,两个不一样

    点赞 评论 复制链接分享
  • danielinbiti danielinbiti 5年前

    确认是否有android-support-v4.jar包
    如果是发布后的,确认是否这个包也发布出去了
    如果是eclipse,需要进行下设置
    选择Build Path ->Configure Build Path,然后选择Order and export 选项.把android-support-v4.jar选项勾上
    不然发布的时候不会带这个jar

    点赞 评论 复制链接分享

为你推荐