1. 程式人生 > >異常java.lang.NoClassDefFoundError: android.support.v7.widget.TintManager的解決辦法

異常java.lang.NoClassDefFoundError: android.support.v7.widget.TintManager的解決辦法

本文轉載自:http://blog.csdn.net/zhou12314/article/details/52120063

最近在寫專案的時候,需要匯入別的工程,在匯入工程的時候,編譯也通過了,專案也沒有報錯,但是在執行的時候,就出現了這個異常:

java.lang.NoClassDefFoundError: android.support.v7.widget.TintManager
                                at android.support.design.widget.TabLayout$TabView.<init>(TabLayout.java:1185)
                                at android.support.design.widget.TabLayout.createTabView(TabLayout.java:656)
                                at android.support.design.widget.TabLayout.addTabView(TabLayout.java:695)
                                at android.support.design.widget.TabLayout.addTab(TabLayout.java:386)
                                at android.support.design.widget.TabLayout.addTab(TabLayout.java:361)
                                at android.support.design.widget.TabLayout.setTabsFromPagerAdapter(TabLayout.java:645)
                                at android.support.design.widget.TabLayout.setupWithViewPager(TabLayout.java:616)
                                at com.cniao5.app36kr_cnk.fragment.MainInfoFragment.initValidata(MainInfoFragment.java:72)
                                at com.cniao5.app36kr_cnk.fragment.MainInfoFragment.onCreateView(MainInfoFragment.java:42)
                                at android.support.v4.app.Fragment.performCreateView(Fragment.java:1974)
                                at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1036)
                                at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1230)
                                at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1332)
                                at android.support.v4.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2288)
                                at android.support.v4.app.FragmentController.onCreateView(FragmentController.java:120)
                                at android.support.v4.app.FragmentActivity.dispatchFragmentsOnCreateView(FragmentActivity.java:356)
                                at android.support.v4.app.BaseFragmentActivityHoneycomb.onCreateView(BaseFragmentActivityHoneycomb.java:31)
                                at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:79)
                                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
                                at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
                                at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                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 android.view.LayoutInflater.inflate(LayoutInflater.java:353)
                                at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:296)
                                at android.app.Activity.setContentView(Activity.java:1973)
                                at com.cniao5.app36kr_cnk.ui.MainActivity.onCreate(MainActivity.java:46)
                                at android.app.Activity.performCreate(Activity.java:5351)
                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257)
                                at android.app.ActivityThread.access$800(ActivityThread.java:143)
                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
                                at android.os.Handler.dispatchMessage(Handler.java:102)
                                at android.os.Looper.loop(Looper.java:136)
                                at android.app.ActivityThread.main(ActivityThread.java:5120)
                                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:818)
                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
                                at dalvik.system.NativeStart.main(Native Method)

後來仔細找了一下,發現是使用design包中TabLayout的問題,

只需要將專案中build.gradle中的design包依賴的版本號改為 23.2.1即可。

如下圖所示: