[Solved] Android Error: E/EGL_adreno: tid 3927: eglSurfaceAttrib(1334): error 0x3009 (EGL_BAD_MATCH)

1. Error Messages:

E/EGL_adreno: tid 3927: eglSurfaceAttrib(1334): error 0x3009 (EGL_BAD_MATCH)

java.lang.OutOfMemoryError: Failed to allocate a 146313228 byte allocation with 16777216 free bytes and 115MB until OOM

在这里插入图片描述

 

2. Reason

Description: The memory of our Android project is overflowing, my guess is that the reason may be the difference in resolution leading to memory overflow of the project content or too much content to load (images and other resources)
Especially controls that load a lot of data in a list have custom images.

 

3. Solution

Original Codes

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.MyFourth"
        >
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service android:name=".service.MusicService"/>
    </application>

Add the following codes after <application:

android:largeHeap="true"
android:hardwareAccelerated="false"

Full Modified Codes

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.MyFourth"
        
        android:largeHeap="true"
        android:hardwareAccelerated="false"

        >
        <activity
            android:name=".MainActivity"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <service android:name=".service.MusicService"/>
    </application>
android:hardwareAccelerated="true"

An application that uses largeHeap will request the system to allocate more memory space for the Dalvik virtual machine. It is also easy to use, just add android:largeHeap=”true” to the application node of the manifest file.

android:hardwareAccelerated="false" 

The default is true which will start hardware acceleration but will, however, take up memory

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *