直到昨天我的应用程序工作正常,但我所做的是,由于某些原因,我不得不在Android Studio中使用不同的工作空间打开相同的应用程序。从那时起,当我尝试运行应用程序时,我得到了以下异常,所以我已经删除了新创建的工作节奏,但我仍然坚持以下的胖异常。
Throwing OutOfMemoryError "Failed to allocate a 170 byte allocation with 74 free bytes and 74B until OOM" (recursive case)
"main" prio=5 tid=1 Runnable
| group="main" sCount=0 dsCount=0 obj=0x74430970 self=0xb4606800
| sysTid=1905 nice=0 cgrp=apps sched=0/0 handle=0xb777c160
| state=R schedstat=( 0 0 0 ) utm=83 stm=36 core=0 HZ=100
| stack=0xbf15b000-0xbf15d000 stackSize=8MB
| held mutexes= "mutator lock"(shared held)
at java.lang.String.<init>(String.java:233)
at java.lang.String.<init>(String.java:191)
at java.io.ByteArrayOutputStream.toString(ByteArrayOutputStream.java:175)
at java.util.jar.ManifestReader.readValue(ManifestReader.java:181)
at java.util.jar.ManifestReader.readHeader(ManifestReader.java:107)
at java.util.jar.ManifestReader.readEntries(ManifestReader.java:59)
at java.util.jar.JarVerifier.verifyCertificate(JarVerifier.java:311)
at java.util.jar.JarVerifier.readCertificates(JarVerifier.java:268)
at java.util.jar.JarFile.getInputStream(JarFile.java:380)
at libcore.net.url.JarURLConnectionImpl.getInputStream(JarURLConnectionImpl.java:222)
at java.net.URL.openStream(URL.java:470)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:444)
at java.lang.Class.getResourceAsStream(Class.java:1334)
at com.google.m.a.a.a.a(unavailable:-1)
at com.google.m.a.a.a.a(unavailable:-1)
at com.google.maps.api.android.lib6.b.e.<init>(unavailable:-1)
at com.google.maps.api.android.lib6.b.e.<init>(unavailable:-1)
at com.google.maps.api.android.lib6.b.e.a(unavailable:-1)
at com.google.maps.api.android.lib6.c.dz.a(unavailable:-1)
[ 03-30 11:13:03.162 1905: 1914 I/art ]
Clamp target GC heap from 64MB to 64MB
--------- beginning of crash
03-30 11:13:03.179 1905-1905/com.example.myothermap E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.myothermap, PID: 1905
java.lang.OutOfMemoryError: OutOfMemoryError thrown while trying to throw OutOfMemoryError; no stack available
我该如何从中恢复?
答案 0 :(得分:0)
尝试将其添加到构建包中:
将此代码添加到Android标签中
dexOptions {
javaMaxHeapSize "4g"
}
答案 1 :(得分:-1)
将此行添加到Application标记内项目的Manifest文件中。
android:largeHeap="true"
像这样
<application
android:largeHeap="true"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >