**java.lang.OutOfMemoryError: pthread_create (1040KB stack) failed: Try again**
at java.lang.Thread.nativeCreate(Native Method)
at java.lang.Thread.start(Thread.java:730)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:941)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1359)
at okhttp3.Dispatcher.enqueue(Dispatcher.java:129)
at okhttp3.RealCall.enqueue(RealCall.java:78)
at retrofit2.OkHttpCall.enqueue(OkHttpCall.java:101)
在应用停留模式下,有时应用会崩溃。
答案 0 :(得分:0)
尝试这种方式:
在AndroidManifest.xml中 1-设置android:largeHeap="true"
2-在org.gradle.jvmargs=-Xmx1536m
上将org.gradle.jvmargs=-Xmx4608m
更改为gradle.properties
3-及在build.gradle上:
android {
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
}