ViewPager因通货膨胀而崩溃

时间:2016-09-02 16:27:33

标签: android android-viewpager

打开我的应用程序的第一个屏幕时,我遇到了崩溃。其中150个实际上是(仅检测到一个用户),Android 4.4.2与设备Samsung GT-N7100。

Fabric screenshot

尝试使用多台设备后,我无法复制它......

我的第一个线索是搜索书法库中的错误,但根据那里报告的类似错误,它指向它们但是是一个错误的“堆栈内疚线”。这可能与特定的布局线有关......

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.app.myapp/com.app.mymags.features.product.activities.ProductDetailActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class <unknown>
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2413)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
       at android.app.ActivityThread.access$900(ActivityThread.java:175)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:146)
       at android.app.ActivityThread.main(ActivityThread.java:5602)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by android.view.InflateException: Binary XML file line #9: Error inflating class <unknown>
       at android.view.LayoutInflater.createView(LayoutInflater.java:626)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.createCustomViewInternal(SourceFile:211)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.access$000(SourceFile:20)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$PrivateWrapperFactory2.onCreateView(SourceFile:302)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(SourceFile:60)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
       at com.app.mymags.features.product.viewbuilders.imagecarousel.ImageCarouselViewBuilder.(SourceFile:28)
       at com.app.mymags.features.product.fragments.imagecarousel.ImageCarouselFragment.onCreateView(SourceFile:92)
       at android.app.Fragment.performCreateView(Fragment.java:1700)
       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
       at android.app.BackStackRecord.run(BackStackRecord.java:684)
       at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1453)
       at android.app.Activity.performStart(Activity.java:5460)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2386)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
       at android.app.ActivityThread.access$900(ActivityThread.java:175)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:146)
       at android.app.ActivityThread.main(ActivityThread.java:5602)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.reflect.InvocationTargetException
       at java.lang.reflect.Constructor.constructNative(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
       at android.view.LayoutInflater.createView(LayoutInflater.java:600)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.createCustomViewInternal(SourceFile:211)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.access$000(SourceFile:20)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$PrivateWrapperFactory2.onCreateView(SourceFile:302)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(SourceFile:60)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
       at com.app.mymags.features.product.viewbuilders.imagecarousel.ImageCarouselViewBuilder.(SourceFile:28)
       at com.app.mymags.features.product.fragments.imagecarousel.ImageCarouselFragment.onCreateView(SourceFile:92)
       at android.app.Fragment.performCreateView(Fragment.java:1700)
       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
       at android.app.BackStackRecord.run(BackStackRecord.java:684)
       at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1453)
       at android.app.Activity.performStart(Activity.java:5460)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2386)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
       at android.app.ActivityThread.access$900(ActivityThread.java:175)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:146)
       at android.app.ActivityThread.main(ActivityThread.java:5602)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
       at dalvik.system.NativeStart.main(NativeStart.java)
Caused by java.lang.OutOfMemoryError
       at android.graphics.BitmapFactory.nativeDecodeAsset(BitmapFactory.java)
       at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:683)
       at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:513)
       at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:889)
       at android.content.res.Resources.loadDrawable(Resources.java:3436)
       at android.content.res.Resources.getDrawable(Resources.java:1909)
       at android.support.v7.widget.TintResources.superGetDrawable(SourceFile:48)
       at android.support.v7.widget.AppCompatDrawableManager.onDrawableLoadedFromResources(SourceFile:374)
       at android.support.v7.widget.TintResources.getDrawable(SourceFile:44)
       at android.widget.EdgeEffect.(EdgeEffect.java:151)
       at android.support.v4.widget.EdgeEffectCompatIcs.newEdgeEffect(SourceFile:30)
       at android.support.v4.widget.EdgeEffectCompat$EdgeEffectIcsImpl.newEdgeEffect(SourceFile:99)
       at android.support.v4.widget.EdgeEffectCompat.(SourceFile:150)
       at android.support.v4.view.ViewPager.initViewPager(SourceFile:375)
       at android.support.v4.view.ViewPager.(SourceFile:360)
       at java.lang.reflect.Constructor.constructNative(Constructor.java)
       at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
       at android.view.LayoutInflater.createView(LayoutInflater.java:600)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.createCustomViewInternal(SourceFile:211)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.access$000(SourceFile:20)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater$PrivateWrapperFactory2.onCreateView(SourceFile:302)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:695)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:498)
       at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(SourceFile:60)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:398)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:354)
       at com.app.mymags.features.product.viewbuilders.imagecarousel.ImageCarouselViewBuilder.(SourceFile:28)
       at com.app.mymags.features.product.fragments.imagecarousel.ImageCarouselFragment.onCreateView(SourceFile:92)
       at android.app.Fragment.performCreateView(Fragment.java:1700)
       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:890)
       at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
       at android.app.BackStackRecord.run(BackStackRecord.java:684)
       at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1453)
       at android.app.Activity.performStart(Activity.java:5460)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2386)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2471)
       at android.app.ActivityThread.access$900(ActivityThread.java:175)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:146)
       at android.app.ActivityThread.main(ActivityThread.java:5602)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
       at dalvik.system.NativeStart.main(NativeStart.java)

它指向的XML是:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/white"
        >

    <android.support.v4.view.ViewPager
            android:id="@+id/image_carousel_pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            style="@style/AppRecycler.Light"/>

</RelativeLayout>

抛出错误的行是ViewPager。

它的风格:

<style name="AppRecycler.Light" parent="Base.AppRecycler.Light"/>

<style name="Base.AppRecycler.Light" parent="">
        <item name="android:background">@android:color/white</item>
        <item name="android:theme">@style/Theme.AppRecycler.Light</item>
    </style>

<style name="Base.AppRecycler.Light" parent="">
        <item name="android:background">@android:color/white</item>
        <item name="android:theme">@style/Theme.AppRecycler.Light</item>
    </style>

由于这似乎是设备用户特定的错误,有没有人知道如何修复它?

或者至少为什么它首先发生?

1 个答案:

答案 0 :(得分:0)

三星有可能定制他们的UI,默认的android提供了一些视图可能无法用于此设备。理想情况下,OEM应该支持默认的android API。三星是否为此设备提供了任何单独的SDK或不进行检查。如果提供验证他们的sdk中的问题。