app:transformClassesWithDexForDebug solution

I have faced below problem

Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’. > com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {–dex –force-jumbo –num-threads=4 –multi-dex –output C:\Users\dtyunlu\AndroidStudioProjects\iris-mobil-android\app\build\intermediates\transforms\dex\debug\folders\1000\5\slice_2 C:\Users\dtyunlu\AndroidStudioProjects\iris-mobil-android\app\build\intermediates\transforms\instantRunSlicer\debug\folders\1\5\slice_2}

Although, tried the solutions from here : https://stackoverflow.com/questions/33915955/android-studio-transformexception-errorexecution-failed-for-task-apptransf

didn’t solve my problem.

So I have deleted this part from my gradle:

dexOptions {
    preDexLibraries true
    javaMaxHeapSize "4g"
    dexInProcess = true
}

It worked and solved my problem