java.lang.OutOfMemoryError : GC overhead limit exceeded on Android 1. 4

标签 java android garbage-collection

在 Android 1.4 上运行 gradle 时,我收到 java.lang.OutOfMemoryError: GC 开销限制超出 ... 这些是我的依赖:

dependencies {
    compile project(':android-crop')
    compile project(':RTEditor-Toolbar')

        compile files('libs/apache-mime4j-0.6.jar')
        compile files('libs/httpmime-4.1.3.jar')
    /*    compile files('libs/httpcore-4.4.1.jar')*/
    compile files('libs/jetbrains-annotations.jar')
    compile files('libs/pinchzoom.jar')
    compile files('libs/gcm.jar')
    compile 'com.google.android.gms:play-services:7.8.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support:appcompat-v7:22.2.1'
    compile 'com.android.support:cardview-v7:22.2.1'
    compile 'com.android.support:design:22.2.1'
    compile 'com.android.support:recyclerview-v7:22.2.1'
    compile 'com.android.support:support-v4:22.2.1'
    //three party library
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.mcxiaoke.volley:library:1.0.18'
    compile 'com.vinaysshenoy:mugen:1.0.1'
    compile 'com.github.clans:fab:1.5.5'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.github.curioustechizen.android-ago:library:1.3.0'
    compile 'com.squareup.okio:okio:1.5.0'
    compile 'com.squareup.okhttp:okhttp:2.4.0'
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.1@aar') {
        transitive = true;
    }

如何解决这个问题?

最佳答案

将此添加到您的 android 闭包(构建 gradle):

 dexOptions {
        javaMaxHeapSize "4g"
 }

这将解决您的问题。不过,如果您遇到问题,请参阅以下链接

GC overhead limit exceeded error

关于java.lang.OutOfMemoryError : GC overhead limit exceeded on Android 1. 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32133013/

相关文章:

java - 从 InputStreamReader 创建 JSONObject

java - 在 hibernate 状态下是否可能有两次相同的 "OneToOne"-Relationship ?

c# - 在静态类中声明的对象何时会被垃圾回收?

java - 对 DAO 进行单元测试

java - 如何使一个数字不生成两次?

java - 基于共享首选项的 LRU 缓存

android - Text to Speech 不能在 API 级别 30 中工作,而不是英语

android - 如何将应用程序限制在特定设备上?

Android:GC 不尊重 SoftReferences?

java - 有没有办法告诉 JVM 当前正在使用哪种 GC 算法