code

Android 스튜디오에서 buildToolsVersion '23 .0.1 '을 업데이트 한 후 메모리 부족 문제

codestyles 2020. 10. 20. 07:38
반응형

Android 스튜디오에서 buildToolsVersion '23 .0.1 '을 업데이트 한 후 메모리 부족 문제


내가 업데이트 한 후 매우 자주 메모리 문제로 밖으로 얻고있다 buildToolsVersion '22.0.1'buildToolsVersion '23.0.1'정말 혼란 스러워요이 오류는로 표시하기 때문에,이 문제를 해결하는 방법을 모른다 buildTools버전 23.0.1. 내가 그것을 변경하면 잘 작동하는 반면 22.0.1. 제발 도와주세요. 다음과 같은 오류를 게시하고 있습니다.

Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_25\bin\java.exe'' finished with non-zero exit value 1

build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.1'

    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        // Enabling multidex support.
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {

    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:support-v4:23.0.1'
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:cardview-v7:23.0.1'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'com.android.support:palette-v7:23.0.1'
    compile 'com.google.android.gms:play-services:7.5.0'
}

미리 감사드립니다.


build.gradle 파일 의 Android 클로저에 다음을 추가 하십시오.

dexOptions {
    javaMaxHeapSize "4g"
}

Android Studio Google JAR 파일로 인해 GC 오버 헤드 제한 초과 오류 발생


허용 대답은 작동하지만 난을 넣을 수있는 위치에 대한 조금 혼란스러워 dexOptions내에서 build.gradle. 우리는 실제로 그것을 android 섹션 아래에 놓았습니다.

다음은 스 니펫의 예입니다.

android {

    dexOptions {
        javaMaxHeapSize "4g"
    }

    ......
}

Actually for me worked a more complex solution, which combine all from above, plus enabling multidex in the build.gradle file for the module.

A. Add this line in the defaultConfig section to enable multiDex

// Enabling multidex support.
multiDexEnabled true

B. Than set the dexOptions, like this:

dexOptions {
    incremental true
    javaMaxHeapSize "4G"
}

C. After changing to multidex and setting the heap to 4g, an overflow error may occur which lead me to uncomment and modify the jvmargs line from gradle.properties file of the project, like:

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

The values may differ depending on your machine. You can also use double values.


In addition to above procedure, there is another option to set jvm arguments.

org.gradle.jvmargs="-Xms2g -Xmx4g" in gradle.properties .

The setting is for tweaking memory. Xms: Starting memory Xmx: Max memory


I solved this problem

  1. go to "System"
  2. Environmental Setting Adwanced
  3. Edit _JAVA_OPTIONS values from "-Xms1024m" to "-Xms2048m"
    (if not Exist _JAVA_OPTIONS than create it click on New Button)
  4. ok & save Restart

I think it will be helpfull for you also. if it usefull upvote this answer.


dexOptions {
        javaMaxHeapSize "4g"
    }

I was facing the same issue by adding this in build.gradle file (module level) solved my problem


use this in your app level build.gradle:

android {
    dexOptions {
        javaMaxHeapSize "4g"
    }
}

참고URL : https://stackoverflow.com/questions/33075646/out-of-memory-issue-after-updating-buildtoolsversion-23-0-1-in-android-studio

반응형