• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by shay4545 · Sep 03, 2014 at 01:17 AM · androidbuildbuild-errorsdkjava

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\C$$anonymous$$ckenWings\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.

Comment

People who like this

0 Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image liortal · Sep 03, 2014 at 09:03 AM 0
Share

It's hard to determine 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/

1 Reply

· Add your reply
  • Sort: 
avatar image

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/".

Comment

People who like this

0 Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image shay4545 · Sep 03, 2014 at 11:58 PM 0
Share

@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 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'

I also put my sdk tools in the C:/Program Files (x86) folder and changed the location in unity.

avatar image zharik86 · Sep 04, 2014 at 05:57 AM 0
Share

@shay4545 I spoke about a root directory of a disk for SDK(I hope you don't divide SDK into parts. Simply SDK 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 AndroidManifest.xml files. Better, of course, that there was one. But it is possible to leave and a some. Then find each AndroidManifest.xml and change the "minSdkVersion" 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.

avatar image shay4545 · Sep 04, 2014 at 11:21 PM 0
Share

@zharik86 The android manifest files did have different target and min SDK 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.

avatar image zharik86 · Sep 05, 2014 at 06:29 AM 0
Share

@shay4545 The problem in those plug-ins which you added means. If you corrected in all the manifest minSDK value files, for example, on 9 and targetSDK, 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 "AdMob" plugin. Try to exclude "AdMob" and "Services Google Play" plugins from the project and to comment out lines, related in scripts. Build project. And them import plugin back. Maybe, simple re-import plugins.

P.S.: See this link

avatar image shay4545 · Sep 05, 2014 at 08:59 PM 0
Share

@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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

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

Cannot build for Android 2 Answers

erorr in building scene ????? 0 Answers

Android - Building Beta Problems. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges