Error building Player: Exception: android (invokation failed) ERROR: unknown error

Error building Player: Exception: android (invokation failed)
ERROR: unknown error
cmd:android list target -c
stdout;
Error occurred during initialization of VM
Could not reserve enough space for object heap
stderr:
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

when i try build an android unity project like the original AngryBots game
the program ask me to locate the sdk,when i locate the sdk folder this error occurred

please help me !!

Hi,

Also you can downgrade the tools version to r21 by installing:

http://dl.google.com/android/installer_r21-windows.exe

Hello, i had the same problem a while ago, take a look at this post http://forum.unity3d.com/threads/88119-Could-not-reserve-enough-space-for-object-heap-RESOLVED

It worked for me.

Just so you know, the tools were updated to 22.01 and it now works with the latest version, no need to downgrade anymore

I had 22.01 installed but that still gave me the error. Reverting back to r21 solved it for me.

If the above fails you like it did me, then try this;

Go into your assets folder (in your os, not unity), then your plugins folder, and find the folder ‘Android’. if you have it there then move it to your desktop ( or delete it, your call ). then try to build your project again.

This was the thing that finally solved it for me.

You must upgrate the version of unity to make it work with the latest sdk!
Hope it helps

A faulty key store can cause this as well. I recreated my keystore and it solved the problem.

Here is A New Video On Fixing All AdMob Problems in Unity (in Hindi/Language) YouTube Link UNITY AdMob Problem Fixed Ads Not Showing ☑ - YouTube