نحوه اجرای R8 را پیکربندی کنید

The settings plugin lets you create execution profiles for the R8 tool, letting you configure how R8 runs so it doesn't slow down your build. Depending on the environment, you can use profiles to run R8 in a separate JVM process and set JVM arguments, such as maximum heap size.

اعلام مشخصات اجرا

Apply the settings plugin , and then add the android block to the settings.gradle file. In this block, you can define different profiles and then set a default, as shown in the following example:

کاتلین

android {
    execution {
        profiles {
            create("server") {
                r8 {
                    runInSeparateProcess = true
                    jvmOptions += listOf("-Xms2048m", "-Xmx8192m", "-XX:+HeapDumpOnOutOfMemoryError")
                }
            }
            create("local") {
                r8 {
                    runInSeparateProcess = true
                    jvmOptions += listOf("-Xms256m", "-Xmx2048m", "-XX:+HeapDumpOnOutOfMemoryError")
                }
            }
            defaultProfile = "server"
        }
    }
}

گرووی

android {
    execution {
        profiles {
            register("server") {
                r8 {
                    runInSeparateProcess = true
                    jvmOptions += ["-Xms2048m", "-Xmx8192m", "-XX:+HeapDumpOnOutOfMemoryError"]
                }
            }
            register("local") {
                r8 {
                    runInSeparateProcess = true
                    jvmOptions += ["-Xms256m", "-Xmx2048m", "-XX:+HeapDumpOnOutOfMemoryError"]
                }
            }
            defaultProfile = "server"
        }
    }
}

نمایه پیش‌فرض را لغو کنید

برای لغو نمایه اجرای پیش‌فرض فعلی، ویژگی زیر را به فایل gradle.properties اضافه کنید.

android.settings.executionProfile=example-profile