Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error com.android.dx.command.Main in Android Studio 2.3

I have error when building project. Anybody have this error before. I updated to Android Studion2.3 and build normally, but now I don't know why having this error. Clean, Rebuild but still have this error.

My gradle

 compileSdkVersion 25
    buildToolsVersion '25'

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 D:\GIT TECHUB\pocca_android.git\app\build\intermediates\transforms\dex\debug\folders\1000\5\slice_2 D:\GIT TECHUB\pocca_android.git\app\build\intermediates\transforms\instantRunSlicer\debug\folders\1\5\slice_2}

like image 888
RoShan Shan Avatar asked Mar 14 '26 22:03

RoShan Shan


2 Answers

add multiDexEnabled true in default config file of build.gradle like this

defaultConfig {
        multiDexEnabled true
       }
like image 157
Akash Moradiya Avatar answered Mar 17 '26 10:03

Akash Moradiya


I found the reason, a file error log created in my app -- insufficient memory. I restart my computer and now I worked. But my computer 16Gb ram, Android Studio only use nearly 2Gb ram, but error still happen

hs_err_pid4936.log

There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (malloc) failed to allocate 604656 bytes for Chunk::new Possible reasons: The system is out of physical RAM or swap space In 32 bit mode, the process size limit was hit Possible solutions: Reduce memory load on the system Increase physical memory or swap space Check if swap backing store is full Use 64 bit Java on a 64 bit OS Decrease Java heap size (-Xmx/-Xms) Decrease number of Java threads Decrease Java thread stack sizes (-Xss) Set larger code cache with -XX:ReservedCodeCacheSize= This output file may be truncated or incomplete.

Out of Memory Error (allocation.cpp:390), pid=4936, tid=0x000000000000156c

JRE version: Java(TM) SE Runtime Environment (8.0_101-b13) (build 1.8.0_101-b13) Java VM: Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode windows-amd64 compressed oops) Failed to write core dump. Minidumps are not enabled by default on client versions of Windows

like image 27
RoShan Shan Avatar answered Mar 17 '26 12:03

RoShan Shan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!