- Home /
Java error when building
I have tried adding a system variable in environment variable called JAVA_HOME with the path as my Java folder: C:\Program Files (x86)\Java\jre7\bin
but I still get the error as follows.
I am getting this error when building my android project:
Error building Player: Win32Exception: ApplicationName='C:\Program Files (x86)\Java\jre7\bin\javac.exe', CommandLine='-bootclasspath "C:/Users/Shay/Documents/Android SDK/adt-bundle-windows-x86_64-20140702/sdk/platforms/android-20\android.jar" -d "C:\Users\Shay\Documents\FlappyBirdTest\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "com\google\android\gms\R.java" "com\google\example\games\basegameutils\R.java" "com\google\example\games\mainlibproj\R.java" "com\ShadowKingdomStudios\ChickenWings\R.java"', CurrentDirectory='C:\Users\Shay\Documents\FlappyBirdTest\Temp\StagingArea\gen'
This is the full error. If anyone knows how to fix this, it would be great help.
It's hard to deter$$anonymous$$e the real cause of error (Unity "swallows" external tools errors and does not present their full output to the screen).
What you could do is run the exact command that Unity runs (get it from the output that you attached) and run it in a command line window. See the full error output and then post it here.
I once blogged about some Unity obscure error and what i did to find its root cause, you can read it to learn how to debug such issues: http://www.tallior.com/2014/02/08/bug-hunting-unity-throws-an-argumentexception-when-building-for-android/
Answer by zharik86 · Sep 03, 2014 at 08:06 AM
Once and I had something similar. Simply update your Java as the current version incorrectly works in the SDK Andtroid version. Generally it is better to set the last Unity, Java and SDK versions. And the second, it is recommended to SDK Android to unpack in a root folder of a disk, i.e. "C:/Android SDK/".
@zharik86 I updated unity, java, and the sdk but I still get the same error.
Error building Player: Win32Exception: ApplicationName='C:\Program Files (x86)\Java\jre7\bin\javac.exe', CommandLine='-bootclasspath "C:/Program Files (x86)/Android SD$$anonymous$$/adt-bundle-windows-x86_64-20140702/sdk/platforms/android-20\android.jar" -d "C:\Users\Shay\Documents\FlappyBirdTest\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "com\google\android\gms\R.java" "com\google\example\games\basegameutils\R.java" "com\google\example\games\mainlibproj\R.java" "com\Shadow$$anonymous$$ingdomStudios\ChickenWings\R.java"', CurrentDirectory='C:\Users\Shay\Documents\FlappyBirdTest\Temp\StagingArea\gen'
I also put my sdk tools in the C:/Program Files (x86) folder and changed the location in unity.
@shay4545 I spoke about a root directory of a disk for SD$$anonymous$$(I hope you don't divide SD$$anonymous$$ into parts. Simply SD$$anonymous$$ have a "tools" folder). As far as I see from the error message, you use a certain plug-in for Services Google Play. Even if it not so, most likely in your project some Android$$anonymous$$anifest.xml files. Better, of course, that there was one. But it is possible to leave and a some. Then find each Android$$anonymous$$anifest.xml and change the "$$anonymous$$SdkVersion" and "targetSdkVersion" fields so that they matched for each file. And for fields it is better to take values >= 9.(Android 2.1)
P.S: To be convinced that you have a problem only with the project, try to create the new project and at once to compile it for the android (to create apk). If everything is normal, a problem somewhere in your project.
@zharik86 The android manifest files did have different target and $$anonymous$$ SD$$anonymous$$ versions. I corrected them but still got the error. I check the folder in the error at "C:\Users\Shay\Documents\FlappyBirdTest\Temp\StagingArea\bin\classes" but the folder is empty. Does it want me to put something in that folder? I also tried building a new project for android and it worked fine. So I guess the problem is in my project somewhere.
@shay4545 The problem in those plug-ins which you added means. If you corrected in all the manifest $$anonymous$$SD$$anonymous$$ value files, for example, on 9 and targetSD$$anonymous$$, for example, on 14, and you continue to receive an error, try to remove plug-ins in turn. For example, I know that such error occurs because of "Ad$$anonymous$$ob" plugin. Try to exclude "Ad$$anonymous$$ob" and "Services Google Play" plugins from the project and to comment out lines, related in scripts. Build project. And them import plugin back. $$anonymous$$aybe, simple re-import plugins.
P.S.: See this link
@zharik86 Well I checked out the link and noticed it said something about only one plugin working at a time. I checked to see my plugins and the google play plugin imported an android and IOS version. I made a new folder called "GooglePlay" and put both folders in there. Then I pressed build and I had no errors. I have no idea why this would fix the error but it looks like either that was it or it fixed the error on its own somehow... Thanks for all your help by the way, I really appreciate it!
Your answer
Follow this Question
Related Questions
I have a problem with my sdk version. Please help me 0 Answers
Facebook SDK and Audience Network SDK Android conflict 1 Answer
erorr in building scene ????? 0 Answers
Cannot build for Android 2 Answers
Android - Building Beta Problems. 0 Answers