scwang90 / SmartRefreshLayout

🔥下拉刷新、上拉加载、二级刷新、淘宝二楼、RefreshLayout、OverScroll,Android智能下拉刷新框架,支持越界回弹、越界拖动,具有极强的扩展性,集成了几十种炫酷的Header和 Footer。
https://segmentfault.com/a/1190000010066071
Apache License 2.0
24.94k stars 4.96k forks source link

App不能启动 #2

Closed appdev closed 7 years ago

appdev commented 7 years ago

demo下载后不能运行:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.scwang.refreshlayout/com.scwang.refreshlayout.activity.IndexMainActivity}: android.view.InflateException: Binary XML file line #17: Error inflating class com.scwang.smartrefresh.header.DeliveryHeader
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269)
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135)
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:136)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5045)
                                                     at java.lang.reflect.Method.invokeNative(Native Method)
                                                     at java.lang.reflect.Method.invoke(Method.java:515)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
                                                     at dalvik.system.NativeStart.main(Native Method)
                                                  Caused by: android.view.InflateException: Binary XML file line #17: Error inflating class com.scwang.smartrefresh.header.DeliveryHeader
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:620)
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
                                                     at com.scwang.refreshlayout.fragment.RefreshStylesFragment.onCreateView(RefreshStylesFragment.java:80)
                                                     at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192)
                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
                                                     at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
                                                     at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758)
                                                     at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363)
                                                     at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149)
                                                     at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
                                                     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013)
                                                     at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388)
                                                     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:607)
                                                     at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
                                                     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1188)
                                                     at android.app.Activity.performStart(Activity.java:5241)
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2179)
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269) 
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:136) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5045) 
                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                     at dalvik.system.NativeStart.main(Native Method) 
                                                  Caused by: java.lang.reflect.InvocationTargetException
                                                     at java.lang.reflect.Constructor.constructNative(Native Method)
                                                     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:594)
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                                                     at com.scwang.refreshlayout.fragment.RefreshStylesFragment.onCreateView(RefreshStylesFragment.java:80) 
                                                     at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192) 
                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299) 
                                                     at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528) 
                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595) 
                                                     at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758) 
                                                     at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363) 
                                                     at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149) 
                                                     at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103) 
                                                     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013) 
                                                     at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388) 
                                                     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:607) 
                                                     at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178) 
                                                     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1188) 
                                                     at android.app.Activity.performStart(Activity.java:5241) 
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2179) 
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269) 
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:136) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5045) 
                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                     at dalvik.system.NativeStart.main(Native Method) 
                                                  Caused by: java.lang.NoSuchMethodError: android.view.View.<init>
                                                     at com.scwang.smartrefresh.header.DeliveryHeader.<init>(DeliveryHeader.java:59)
                                                     at com.scwang.smartrefresh.header.DeliveryHeader.<init>(DeliveryHeader.java:54)
                                                     at com.scwang.smartrefresh.header.DeliveryHeader.<init>(DeliveryHeader.java:50)
                                                     at java.lang.reflect.Constructor.constructNative(Native Method) 
                                                     at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
                                                     at android.view.LayoutInflater.createView(LayoutInflater.java:594) 
                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) 
                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492) 
                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397) 
                                                     at com.scwang.refreshlayout.fragment.RefreshStylesFragment.onCreateView(RefreshStylesFragment.java:80) 
                                                     at android.support.v4.app.Fragment.performCreateView(Fragment.java:2192) 
                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299) 
                                                     at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528) 
                                                     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595) 
                                                     at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:758) 
                                                     at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2363) 
                                                     at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2149) 
                                                     at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103) 
                                                     at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013) 
                                                     at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388) 
                                                     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:607) 
                                                     at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178) 
                                                     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1188) 
                                                     at android.app.Activity.performStart(Activity.java:5241) 
                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2179) 
                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269) 
                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135) 
                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 
                                                     at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                     at android.os.Looper.loop(Looper.java:136) 
                                                     at android.app.ActivityThread.main(ActivityThread.java:5045) 
                                                     at java.lang.reflect.Method.invokeNative(Native Method) 
                                                     at java.lang.reflect.Method.invoke(Method.java:515) 
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 
                                                     at dalvik.system.NativeStart.main(Native Method) 
appdev commented 7 years ago

好吧解决了 删除几个Header类中5.0的初始化方法,把初始化方法放到上面的方法就好了 这样在Android5.0一下的设备就能正常初始化了

scwang90 commented 7 years ago

谢谢你的反馈,这个问题如果不及早处理,真的很严重