Search Unity

UnityAds does not integrate into any Unity Project, crashes Build

Discussion in 'Unity Ads & User Acquisition' started by lvl9hero, Dec 1, 2014.

  1. lvl9hero

    lvl9hero

    Joined:
    Jul 30, 2013
    Posts:
    8
    Spent more hours trying to read up on this error caused specifically by UnityAds than writing my game...

    Error building Player: Win32Exception: ApplicationName='C:\Program Files (x86)\Java\jre1.8.0_20\bin\javac.exe', CommandLine='-bootclasspath "C:/Android SDK ADT/adt-bundle-windows-x86_64-20140624/sdk/platforms/android-20\android.jar" -d
    Downloaded UnityAds Package from Unity Asset Store.
    Imported Package into my Project fine.
    Added the scripts fine.

    Trying to make a build = crash with that error shown above.

    Nothing on Google helps either, only found 1 other forum thread talking about this same issue which is also inconclusive and very janky answers that did not help me either when I tried out their solution.

    Windows 7 64-bit
    Unity 4.6
    Android
     
  2. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    The PATH system variable is missing a reference to your JDK installation. As it is, Unity is trying to locate the Java compiler within the path to your Java Runtime Engine instead. You'll need to add the JDK path reference to the environment variable yourself in System Preferences.

    See how to add or change the values of environment variables.

    Keep in mind, you'll need to restart your Windows session for these settings to take effect.
     
  3. lvl9hero

    lvl9hero

    Joined:
    Jul 30, 2013
    Posts:
    8
    Yes thanks, I tried that out as well following a post I found java-related on Unity Answers, I added a new environment variable "JDK_HOME" and pointed it to my JDK installation root folder, but unfortunately that did not do anything either.

    However,

    I went into Control Panel, and Uninstalled every "Java" related, as long as it had the orange Java icon, I uninstalled it. Manually looked into all my Program Files folders to find and delete all Java related folders.
    Then I went ahead to re-download the Java JDK from Java's website and then re-installed just that alone.

    Apparently it automatically creates/installs a JRE too which is great.

    UnityAds and Unity compiles okay now.

    Thanks.
     
  4. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Nice! Glad that worked out.

    Keep in mind, for the variable, you can create a custom variable like "JDK_HOME", but you still need to add a reference to it in the PATH variable. Custom variables are helpful in keeping things readable and manageable. You can reference them from the PATH variable by wrapping them in % characters. So, in the PATH variable, you'll add %JDK_HOME%.

    Another thing to keep in mind is scope. If you create "JDK_HOME" as a system variable, you an simply add it to the PATH system variable. But if you create it as a user variable, you'll need to create a "PATH" user variable as well. The user variables are out of scope of system variables. Also, the user PATH variable doesn't override the system PATH variable. Both PATH variables will be referenced when called.
     
  5. Zyrcox

    Zyrcox

    Joined:
    Jan 7, 2013
    Posts:
    10
    I just got the same problem, happens on x64 windows, I went through installing JDK x86, didn't want to mess up with environnement variables and reboot :) a bit strange unity checks in programfilesx86 instead of programfiles by default.