I got a lot of mistakes, but I think that the main one is, tell me please, what's the problem?

FATAL EXCEPTION: main Process: com.kalinwallik.csgoinfo, PID: 25717 java.lang.OutOfMemoryError: Failed to allocate a 28545036 byte allocation with 4176736 free bytes and 3MB until OOM 

The application just crashes when switching to this activation.

 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/content_info__map" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="com.kalinwallik.csgoinfo.Info_Map" tools:showIn="@layout/main_info_map" android:background="@color/colorPrimaryDark"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <GridLayout android:layout_width="fill_parent" android:layout_height="580dp" android:columnWidth="90dp" android:numColumns="1" android:orientation="vertical" android:layout_gravity="center"> <ImageButton android:layout_width="170dp" android:layout_height="135dp" android:src="@drawable/m_dust_two" android:scaleType="centerInside" android:background="@color/colorPrimaryDark" android:layout_row="0" android:layout_column="0" android:id="@+id/button_dusttwo" /> <ImageButton android:layout_width="170dp" android:layout_height="135dp" android:src="@drawable/m_mirage" android:scaleType="centerInside" android:background="@color/colorPrimaryDark" android:layout_row="0" android:layout_column="2" android:id="@+id/button_mirage" /> <ImageButton android:layout_width="170dp" android:layout_height="135dp" android:src="@drawable/m_cache" android:scaleType="centerInside" android:background="@color/colorPrimaryDark" android:layout_row="1" android:layout_column="0" android:id="@+id/button_cache" /> <ImageButton android:layout_width="170dp" android:layout_height="135dp" android:src="@drawable/m_inferno" android:scaleType="centerInside" android:background="@color/colorPrimaryDark" android:layout_row="1" android:layout_column="2" android:id="@+id/button_inferno" /> <ImageButton android:layout_width="170dp" android:layout_height="135dp" android:src="@drawable/m_train" android:scaleType="centerInside" android:background="@color/colorPrimaryDark" android:layout_row="2" android:layout_column="0" android:id="@+id/button_train" /> <ImageButton android:layout_width="170dp" android:layout_height="135dp" android:src="@drawable/m_overpass" android:scaleType="centerInside" android:background="@color/colorPrimaryDark" android:layout_row="2" android:layout_column="2" android:id="@+id/button_overpass" /> <ImageButton android:layout_width="170dp" android:layout_height="135dp" android:src="@drawable/m_cobston" android:scaleType="centerInside" android:background="@color/colorPrimaryDark" android:layout_row="3" android:layout_column="0" android:id="@+id/button_cobston" /> <ImageButton android:layout_width="170dp" android:layout_height="135dp" android:src="@drawable/m_nuke" android:scaleType="centerInside" android:background="@color/colorPrimaryDark" android:layout_row="3" android:layout_column="2" android:id="@+id/button_nuke" /> </GridLayout> </LinearLayout> 

  • Please indicate which error occurs. - Mikhail Vaysman
  • Good afternoon Dima. You know, finding an error is one thing but you need to know the error. Look at the log and put it here - elik
  • I check through the real device, press the button that translates to this activation and the application closes with an error - Dima Kalistratov
  • To find out where the error at the bottom of the panel in AndidStudio is the AndroidMonitor section, go there and there will be a work process. You will notice the error and copy it and put it here - elik
  • Do you add activity to the manifesto? - elik

1 answer 1

This is an out of memory error for expanding bitmaps for ImageButton

Apparently, you did not bother mapping bitmaps depending on the density

Run your bitmaps through this tool and scatter on drawable-hdpi/mdpi and so on.

  • I have not been in this programming for a long time, if I scatter by drawable-hdpi / mdpi, can I remove or leave drawable0? - Dima Kalistratov
  • You can leave. - Barmaley
  • mipmap-hdpi and darawadle-hdpi the same thing? - Dima Kalistratov
  • In my opinion mipmap for pictures in the style of flat design and drawables for photographs for example - Flippy