• 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 /
This question was closed Dec 11, 2014 at 02:29 PM by meat5000 for the following reason:

The question is answered, right answer was accepted Also, Duplicate Question.

avatar image
Question by Nesokas · Oct 21, 2014 at 10:01 PM · android

Error when compiling Android

Hello everyone,

I'm running Unity 4.6 in OS X 10.9.5, and I'm getting the following error when I try to compile to android:

 Failed to compile resources with the following parameters:
 -bootclasspath "/Users/ines/Development/android-sdk-macosx/platforms/android-21/android.jar" -d "/Users/ines/Documents/Game/Temp/StagingArea/bin/classes" -source 1.6 -target 1.6 -encoding UTF-8 "com/Company/Game/R.java" "com/facebook/android/R.java"
 warning: java/lang/Object.class(java/lang:Object.class): major version 51 is newer than 50, the highest major version supported by this compiler.
 It is recommended that the compiler be upgraded.

Does anyone know how I can solve this problem?

Comment
drawcode
idiot333
Lohoris2
GabLeRoux

People who like this

4 Show 2
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 eatsleepindie · Oct 22, 2014 at 07:03 AM 0
Share

It's been a while since my problems with porting to Android, but make sure you've installed the 32-bit version of the java SDK and not the 64-bit. Can't say for sure it's still an issue, but several months ago this sidelined my Android development for a while.

avatar image Neophen · Oct 31, 2014 at 08:36 PM 0
Share

Hey guys can someone please point me the way to do this on mac yosemite?

4 Replies

  • Sort: 
avatar image
Best Answer

Answer by Nesokas · Oct 22, 2014 at 02:21 PM

Thank you guys. I've found the solution.

Steps to make this work:

  1. Set the JAVA_HOME environment value:

    export JAVA_HOME= ` /usr/libexec/java_home `

  2. Add the java bin folder to the PATH variable:

    export PATH=$JAVA_HOME/bin:$PATH

  3. Create a link in the following directory:

    sudo ln -nsf /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents \ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK

And that's it. Hope it helps.

Comment
Paulius-Liekis
liszto
drawcode
Eugenio
Trungdv
Monsters art
thienhaflash
yang222
koblavi

People who like this

9 Show 8 · 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 emils72 · Oct 22, 2014 at 08:56 PM 0
Share

Thank you very much Nesokas!!! It worked like a charm to me!!

avatar image warchild14 · Oct 24, 2014 at 01:11 AM 0
Share

I am using OSX 10.10 and JDK1.8.0_25. I had to use the command:

1- export JAVA_HOME=`/usr/libexec/java_home -v 1.8` 2- export PATH=$JAVA_HOME/bin:$PATH

but at the 3rd step I get: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK: No such file or directory

My error is because I updated the Android SDK... I guess I should target a specific folder that I am missing here. :~~

avatar image Nesokas · Oct 24, 2014 at 01:20 AM 0
Share

Try locate the java home directory manually

open /Library

try to navigate the folders until you find java home. Then copy the path and do:

export JAVA_HOME="path_you_copied"

Hope you can solve it ;)

avatar image warchild14 · Oct 24, 2014 at 01:39 AM 0
Share

Thank yooouuu, girl. You rock. I found the folder /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK, and yeah, the CurrentJDK link was pointing to 1.6.0

I manually made an alias of the folder /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents as "CurrentJDK" and placed it /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK

worked! :D

Somehow terminal was not finding the folder. :~

Tnks, again. :~~

obs: cannot thumb up your answer because I have not enough reputation D:

avatar image noosxe · Nov 01, 2014 at 12:02 AM 0
Share

This really helped, thanks!

Show more comments
avatar image

Answer by saranpol · Nov 12, 2014 at 07:55 AM

For people who doesn't have new JDK version

  1. download JDK of mac os x : https://jdk8.java.net/download.html

  2. sudo ln -nsf /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/ /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK

Comment
drawcode
Fliperamma
sajornad
jevans70

People who like this

4 Show 3 · 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 sametkaya · Nov 24, 2014 at 01:55 PM 0
Share

Thank you very much.

I've tried everything but nothing work.

your idea help to solve my problem.

thank you!

avatar image Fliperamma · Jan 09, 2015 at 07:10 PM 0
Share

Thank you!

avatar image sajornad · Apr 02, 2015 at 02:22 AM 0
Share

Perfect solution! Thanks!!

avatar image

Answer by liortal · Oct 22, 2014 at 06:09 AM

It probably means Unity is running a Java compiler of some version and a JRE of a different (higher) version.

The compiler complains that it can only support version 50, but you are using version 51.

Check whether you have multiple Java installations on your machine, and the environment variables that you set.

Either leave only 1 installation, or make sure that Unity will use the correct JDK and JRE by setting the environment variables correctly.

Comment

People who like this

0 Show 6 · 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 Yury-Habets · Nov 24, 2014 at 04:42 PM 0
Share

Starting from Android 5.0, Google requires Java 1.7. We are updating Unity requirements to match it (currently it is 1.6).

avatar image liortal · Dec 11, 2014 at 10:34 AM 0
Share

What does that mean? I have all android platforms and tools installed (up to the latest 5.0). I am on Unity 4.5.4 is it compatible ?

avatar image Yury-Habets · Dec 11, 2014 at 02:22 PM 0
Share

It is. But as stated in http://unity3d.com/unity/system-requirements - you also need JDK installed. Now minimum requirement for JDK version is 1.7, you can check it by running "javac -version".

avatar image liortal · Dec 11, 2014 at 02:28 PM 0
Share

I have JDK 1.8.0.25 installed. When building my Android project it fails for this error (compiler is 51). When i go to Android SDK and rename the folder platforms/android-21 to platforms/android-dont-21 it works fine.

avatar image Yury-Habets · Dec 11, 2014 at 04:07 PM 0
Share

I assume you double checked your JAVA_HOME and PATH variables, and ran the command I mentioned earlier. In this case please drop us an email with your editor log or submit a bug.

Show more comments
avatar image

Answer by deadfish90 · Oct 31, 2014 at 09:43 PM

After upgrading my Android SDK version, I was having this error. I followed all the steps outlined for changing default Java version, environment, etc. I installed newest version of JDK (8), still nothing. I found that I needed to uninstall JDK 6 as final step to get everything to work again.

Comment

People who like this

0 Show 0 · 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

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Draw a line between two points Dynamically ? 2 Answers

Coliision detection seems late ? 0 Answers

Unity Pro vs Android/iOS Pro 2 Answers

PC-only assets? 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