I tried setting different Gradle Vm Option from all the answers found on stackoverflow, but nothing seems to be working out I'm on Android Studio 1.2.2 I'm getting this error when I try to run the app on either on the emulator or the device.
Only thing that is working for me is that I need to setup new project in different directories, but it only works for 3 instances and then bang, this error pops up. It is a tedious job to do above mentioned process for 10x times.
Edit_1 : I even tried invalidating caches/restart, doesn't work out
Usually running gradle assembleDebug from hand or from Gradle menu (right side of screen -> app -> Tasks -> build -> assembleDebug) is giving much more info.
In my case it showed problems in resources files.
It has happened to me and the cause has been different every time.
The first was an error in an xml file. I figured it out by reverting to the latest stable commit. The error was a missing "/>" closing tag. I don't know why android studio didn't point it out. This has happened to several of my co workers
The second time the fix was adding a line -Xmx256m or -Xmx512m
In: File->Setting->Build, Deployment &Execution->Build Tools->Gradle->Gradle Vm Option
Hope it helps
This can be because you have specified any command line option in android studio settings. You can check this by going to
File > Settings > Build, Execution, Deployment > Compiler
and see "Command-line-options" and check if anything is give. (In your case -x). If so remove it and click Apply and Ok. It worked in my case...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With