错误:Binary XML file line #27: Error inflating class android.support.v7.widget.ActionBarContainer

 Caused by: android.view.InflateException: Binary XML file line #27: Binary XML file line #27: Error inflating class android.support.v7.widget.ActionBarContainer
                                                                     Caused by: android.view.InflateException: Binary XML file line #27: Error inflating class android.support.v7.widget.ActionBarContainer
                                                                     Caused by: java.lang.reflect.InvocationTargetException
                                                                        at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                        at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                                                                        at android.view.LayoutInflater.createView(LayoutInflater.java:652)
                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:812)
                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)
                                                                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
                                                                        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:522)
                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:430)
                                                                        at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
                                                                        at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:407)
                                                                        at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:324)
                                                                        at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:285)
                                                                        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
                                                                        at com.android.uuuche.View.Welcome.MainActivity.onCreate(MainActivity.java:27)
                                                                        at android.app.Activity.performCreate(Activity.java:6736)
                                                                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                                                                        at cn.jiguang.a.a.c.a.a.d.callActivityOnCreate(Unknown Source)
                                                                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2641)
                                                                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2749)
                                                                        at android.app.ActivityThread.-wrap12(ActivityThread.java)
                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1498)
                                                                        at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                        at android.os.Looper.loop(Looper.java:160)
                                                                        at android.app.ActivityThread.main(ActivityThread.java:6200)
                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:874)
                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:764)
                                                                     Caused by: java.lang.NoSuchMethodError: No static method setBackground(Landroid/view/View;Landroid/graphics/drawable/Drawable;)V in class Landroid/support/v4/view/ViewCompat; or its super classes (declaration of 'android.support.v4.view.ViewCompat' appears in /data/app/com.android.uuuche-2/base.apk:classes53.dex)
                                                                        at android.support.v7.widget.ActionBarContainer.(ActionBarContainer.java:64)
                                                                        at java.lang.reflect.Constructor.newInstance0(Native Method)
                                                                        at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
                                                                        at android.view.LayoutInflater.createView(LayoutInflater.java:652)
                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:812)

                                                                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)


今天在引入第三方的库时候遇到这样的错误,简直是使尽各种,尽管从错误中知道是某些jar包的冲突,但还是费力才弄好,很简单的问题,但是InflateException的一个解决的小分支:

上面的问题明显是由于v7包引起的,我将compileSdkVersion的版本从23升到25时候就报了上面的错误,后直接将v7包在主moudle的gradle升级到最新,v7包你在项目中用到什么就升级什么样的v7,记住版本一定要保持一致:

compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'





你可能感兴趣的:(安卓问题解决)