使用app超过5-10分钟后出现内存不足错误的准确性

时间:2016-02-15 05:12:34

标签: android out-of-memory layout-inflater

当我使用我的应用程序的时间超过7-8分钟时,由于布局不足,我一直在关注内存不足问题。我已经检查了stackoverflow中的许多问题,但一直未能找到一个好的解决方案。我也试过'android:largeHeap =“true”',但它似乎创造了比解决这个问题更多的问题。

02-15 10:40:07.075 2611-2611/? E/art: Throwing OutOfMemoryError "Failed to allocate a 5456172 byte allocation with 3564100 free bytes and 3MB until OOM"  
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime: FATAL EXCEPTION: main
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime: Process: xx.xxxxxxxx.xx, PID: 2611
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime: android.view.InflateException: Binary XML file line #22: Error inflating class <unknown>
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:633)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime: at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime: at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at xx.xxxxxxxx.xx.item_list$MyAdapter.getView(item_list.java:625)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at com.baoyz.swipemenulistview.SwipeMenuAdapter.getView(SwipeMenuAdapter.java:49)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.AbsListView.obtainView(AbsListView.java:2344)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.ListView.makeAndAddView(ListView.java:1864)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.ListView.fillDown(ListView.java:698)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.ListView.fillFromTop(ListView.java:759)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.ListView.layoutChildren(ListView.java:1673)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.AbsListView.onLayout(AbsListView.java:2148)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.View.layout(View.java:15596)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewGroup.layout(ViewGroup.java:4966)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.View.layout(View.java:15596)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewGroup.layout(ViewGroup.java:4966)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.View.layout(View.java:15596)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewGroup.layout(ViewGroup.java:4966)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.View.layout(View.java:15596)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewGroup.layout(ViewGroup.java:4966)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1076)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.View.layout(View.java:15596)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewGroup.layout(ViewGroup.java:4966)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.View.layout(View.java:15596)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewGroup.layout(ViewGroup.java:4966)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1043)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.View.layout(View.java:15596)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewGroup.layout(ViewGroup.java:4966)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.View.layout(View.java:15596)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewGroup.layout(ViewGroup.java:4966)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.View.layout(View.java:15596)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewGroup.layout(ViewGroup.java:4966)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.View.layout(View.java:15596)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewGroup.layout(ViewGroup.java:4966)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2072)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1829)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:     at android.view.Choreographer.doCallbacks(Choreographer.java:580)
02-15 10:40:07.077 2611-2611/? E/AndroidRuntime:    at a

以下是我的item_list页面的布局,我收到此错误     

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="55dp"
    android:background="@color/colorPrimary">

    <SearchView
        android:id="@+id/search"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="5dp"
        android:background="@drawable/bg1x"
        android:iconifiedByDefault="true"
        android:queryHint="Search"
        android:tag="Search">

    </SearchView>


</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="55dp"
    android:background="@color/colorPrimary"
    android:orientation="horizontal">

    <TextView
        android:id="@+id/list_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:layout_gravity="center"
        android:layout_marginLeft="10dp"
        android:clickable="true"
        android:text="LIKED CARS"
        android:textColor="@android:color/white"
        android:textSize="15dp"
        android:textStyle="bold" />

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/layout2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical">

        <TextView
            android:id="@+id/list_notice"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="No liked cars to display"
            android:visibility="gone" />

        <ProgressBar
            android:id="@+id/progress2"
            style="@android:style/Widget.Holo.ProgressBar.Large"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>

    <com.baoyz.swipemenulistview.SwipeMenuListView
        android:id="@+id/listView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />

</LinearLayout>

是的,我的大量数据正在我的列表视图中填充。 有没有办法解决内存不足的问题?

0 个答案:

没有答案