I had gone through several posts over this issue but nothing helped me. The problem is occuring only on large screen devices. Below is stack trace.
Logcat output
03-13 15:21:18.863: E/AndroidRuntime(6334): FATAL EXCEPTION: main
03-13 15:21:18.863: E/AndroidRuntime(6334): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dzo.seattlesnightlife/com.dzo.seattlesnightlife.StoreDescription}: android.view.InflateException: Binary XML file line #29: Error inflating class <unknown>
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.app.ActivityThread.access$600(ActivityThread.java:130)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.os.Handler.dispatchMessage(Handler.java:99)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.os.Looper.loop(Looper.java:137)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.app.ActivityThread.main(ActivityThread.java:4745)
03-13 15:21:18.863: E/AndroidRuntime(6334): at java.lang.reflect.Method.invokeNative(Native Method)
03-13 15:21:18.863: E/AndroidRuntime(6334): at java.lang.reflect.Method.invoke(Method.java:511)
03-13 15:21:18.863: E/AndroidRuntime(6334): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
03-13 15:21:18.863: E/AndroidRuntime(6334): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
03-13 15:21:18.863: E/AndroidRuntime(6334): at dalvik.system.NativeStart.main(Native Method)
03-13 15:21:18.863: E/AndroidRuntime(6334): Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class <unknown>
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-13 15:21:18.863: E/AndroidRuntime(6334): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.parseInclude(LayoutInflater.java:805)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:736)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-13 15:21:18.863: E/AndroidRuntime(6334): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.app.Activity.setContentView(Activity.java:1867)
03-13 15:21:18.863: E/AndroidRuntime(6334): at com.dzo.seattlesnightlife.StoreDescription.init(StoreDescription.java:195)
03-13 15:21:18.863: E/AndroidRuntime(6334): at com.dzo.seattlesnightlife.StoreDescription.onCreate(StoreDescription.java:188)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.app.Activity.performCreate(Activity.java:5008)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
03-13 15:21:18.863: E/AndroidRuntime(6334): ... 11 more
03-13 15:21:18.863: E/AndroidRuntime(6334): Caused by: java.lang.reflect.InvocationTargetException
03-13 15:21:18.863: E/AndroidRuntime(6334): at java.lang.reflect.Constructor.constructNative(Native Method)
03-13 15:21:18.863: E/AndroidRuntime(6334): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-13 15:21:18.863: E/AndroidRuntime(6334): ... 30 more
03-13 15:21:18.863: E/AndroidRuntime(6334): Caused by: java.lang.OutOfMemoryError
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.content.res.Resources.loadDrawable(Resources.java:1930)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.content.res.Resources.getDrawable(Resources.java:659)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:881)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:818)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.content.res.Resources.loadDrawable(Resources.java:1915)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.View.<init>(View.java:3336)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.view.ViewGroup.<init>(ViewGroup.java:427)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.widget.LinearLayout.<init>(LinearLayout.java:176)
03-13 15:21:18.863: E/AndroidRuntime(6334): at android.widget.LinearLayout.<init>(LinearLayout.java:172)
03-13 15:21:18.863: E/AndroidRuntime(6334): ... 33 more
XML Layout file
<com.dzo.seattlesnightlife.ui.HeaderBar
android:id="@+id/baseHeaderBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<com.handmark.pulltorefresh.library.PullToRefreshListView
android:id="@+id/listViewSearch"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/baseHeaderBar"
android:layout_marginBottom="55dp"
android:listSelector="@drawable/list_sel"
android:cacheColorHint="#00000000"
android:divider="@color/divider_list"
android:layout_marginTop="-3dp"
android:dividerHeight="2dp" />
<TextView
android:id="@+id/txtNoData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/no_data"
android:textColor="@color/white"
android:textSize="18sp"
android:visibility="gone" />
<ScrollView
android:id="@+id/scrollLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/baseHeaderBar"
android:layout_marginBottom="60dp"
android:scrollbars="none" >
<LinearLayout
android:id="@+id/linScrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center|top"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/linImgAddress"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/linImgListingPhoto"
android:layout_width="143dp"
android:layout_height="143dp"
android:layout_marginTop="10dp"
android:background="@drawable/bg_description"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/imgListingPhoto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/d_desc"
android:scaleType="fitXY" />
</LinearLayout>
<ImageButton
android:id="@+id/btnFav"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="top|left"
android:layout_marginTop="5dp"
android:background="@drawable/ic_fav"
android:contentDescription="@drawable/ic_fav" />
<LinearLayout
android:id="@+id/linPromoTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="@+id/linImgListingPhoto"
android:layout_marginTop="10dp"
android:layout_marginLeft="5dp"
android:gravity="top"
android:orientation="vertical" >
<TextView
android:id="@+id/txtListingTitle"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/bg_description"
android:gravity="center_vertical|center_horizontal"
android:textColor="@color/white"
android:textSize="20sp" />
<LinearLayout
android:id="@+id/linAddressWebsite"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="3dp"
android:background="@drawable/bg_description"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="32dp"
android:id="@+id/relStoreAddress"
android:background="@drawable/highlight_rnd_top" >
<ImageView
android:id="@+id/imgIcMap"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:contentDescription="@drawable/ic_map"
android:src="@drawable/ic_map" />
<TextView
android:id="@+id/txtStoreAddress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@+id/imgIcMap"
android:layout_centerVertical="true"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="18sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="2dp"
android:contentDescription="@drawable/arrow_white"
android:src="@drawable/arrow_white" />
</RelativeLayout>
<View
android:id="@+id/view2"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_marginBottom="0sp"
android:background="@color/line" />
<RelativeLayout
android:id="@+id/relStoreContact"
android:layout_width="match_parent"
android:layout_height="34dp"
android:background="@drawable/highlight_mid" >
<ImageView
android:id="@+id/imgIcCall"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginLeft="5dp"
android:layout_alignParentLeft="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:contentDescription="@drawable/ic_call"
android:src="@drawable/ic_call" />
<TextView
android:id="@+id/txtStorePhone"
android:layout_toRightOf="@+id/imgIcCall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_centerVertical="true"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="18sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="2dp"
android:contentDescription="@drawable/arrow_white"
android:src="@drawable/arrow_white" />
</RelativeLayout>
<View
android:id="@+id/view3"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_marginBottom="0sp"
android:background="@color/line" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="32dp"
android:id="@+id/relStoreWeb"
android:background="@drawable/highlight_rnd_bottom" >
<ImageView
android:id="@+id/imgIcWeb"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:contentDescription="@drawable/ic_web"
android:src="@drawable/ic_web" />
<TextView
android:layout_toRightOf="@+id/imgIcWeb"
android:id="@+id/txtStoreWebsite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:singleLine="true"
android:textColor="@color/white"
android:textSize="18sp"
android:text="@string/visit_web"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="2dp"
android:contentDescription="@drawable/arrow_white"
android:src="@drawable/arrow_white" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/linDescInfo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginTop="5dp"
android:orientation="vertical" >
<include layout="@layout/part_store_sched_tick" />
<LinearLayout
android:id="@+id/linStoreDescTitle"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="center"
android:gravity="center|top"
android:orientation="vertical"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:visibility="gone" >
<TextView
android:id="@+id/txtDescTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_description"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:singleLine="true"
android:text="@string/d_desc"
android:textColor="@color/white"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/linStoreDesc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@drawable/bg_desc"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone" >
<com.dzo.seattlesnightlife.ui.ExpandablePanel
android:id="@+id/descPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
custom:animationDuration="25"
custom:collapsedHeight="80dp"
custom:content="@+id/txtDesc"
custom:handle="@+id/expand" >
<TextView
android:id="@id/txtDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="18sp"/>
<View
android:id="@+id/view4"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_marginBottom="0sp"
android:background="@color/line"/>
<RelativeLayout
android:id="@id/expand"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/txt_highlight"
android:visibility="gone">
<TextView
android:id="@+id/txtShowMoreLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="@string/show_more"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold"
android:visibility="gone" />
<ImageView
android:id="@+id/imgMoreLess"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerInParent="true"
android:layout_toRightOf="@+id/txtShowMoreLess"
android:background="@drawable/arrow_down"
android:contentDescription="@drawable/arrow_down"
android:visibility="gone" />
</RelativeLayout>
</com.dzo.seattlesnightlife.ui.ExpandablePanel>
</LinearLayout>
<include layout="@layout/part_store_info" />
<LinearLayout
android:id="@+id/linShare"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginTop="8dp"
android:gravity="top|center_horizontal"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linStoreShareBox"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="top"
android:gravity="center_horizontal"
android:orientation="vertical" >
<TextView
android:id="@+id/txtStoreShareTittle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_description"
android:gravity="center|center_vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:singleLine="true"
android:text="@string/d_share"
android:textColor="@color/white"
android:textSize="20sp" />
</LinearLayout>
<include layout="@layout/share_lay_part" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<com.dzo.seattlesnightlife.ui.FooterBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:id="@+id/baseFooterBar"/>
</RelativeLayout>
Whenever I run my app on large screen device or emulator, I get this weired exception. Going through the stack, when I check line no. 29 in XML, it was android:layout_height
for textView. The line no. of activity, on which app crashed was setContentView()
. The OutOfMemoryError
points that there is problem with my drawables. So, I resized my drawables, but nothing helped me. Can't find out what is actual cause of crash.
My Java file. Sorry couldn't post it here as it exceeded body limit, I tailored it as it had around 5k lines of code.
Ok, when I increased heap size to 48 MB app didn't crashed,but with 16 MB heap, it is still crashing.
it would be better if u change the size of images you using. may be that sizes not capable for that device you using.
Your XML error is only the result of the main error : OutOfMemoryError
As long as you don't have find the clue to improve your memory management, you'll have theses kind of errors (XML or other)
Your XML is correct, there is no error in it, the line 29 is the "point" where your application were when the OutOfMemoryError occured
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With