解决:: Failed to allocate a 20971532 byte allocation with 4194304 free bytes...

时间:2025-03-27 16:48:14
05-13 19:10:53.922 15103-15103/? E/AndroidRuntime: FATAL EXCEPTION: main
    Process: .a14412.tvoid1, PID: 15103
    : Failed to allocate a 20971532 byte allocation with 4194304 free bytes and 7MB until OOM
        at (Native Method)
        at (Native Method)
        at (:709)
        at (:544)
        at (:567)
        at (:597)
        at .a14412.(:100)
        at (:6336)
        at (:1113)
        at (:2541)
        at (:2676)
        at .-wrap11()
        at $(:1510)
        at (:111)
        at (:207)
        at (:5786)
        at (Native Method)
        at .internal.$(:889)
        at .internal.(:779)

:添加这两个,我加在了application层级

也可以加在activity级

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