Android Build Fails with UnityAds but works without it: Win32Exception

I’ve been trying to figure this out to no avail. If I remove unityads, and the plugin folder I can build my Android app no problem. As soon as I install UnityAds plugin (OR Chartboost…same problem) it will not build.

Error building Player: Win32Exception: ApplicationName=‘C:\Program Files (x86)\Java\jre7\bin\javac.exe’, CommandLine=‘-bootclasspath “C:/adt-bundle-windows-x86-20140624/sdk/platforms/android-20\android.jar” -d “C:\Users\quentin\Documents\Unity Projects\Feel-A-Maze Free\Temp\StagingArea\bin\classes” -source 1.6 -target 1.6 -encoding UTF-8 “com\fivearchers\feelamazefree\R.java” “com\unity3d\ads\android\R.java”’, CurrentDirectory=‘C:\Users\quentin\Documents\Unity Projects\Feel-A-Maze Free\Temp\StagingArea\gen’

2 Answers

2

This seems to caused by Unity not finding the JDK compiler path. It is trying to use the java-runtime environment for compiling, which will not work:

ApplicationName=‘C:\Program Files (x86)\Java\ jre7 \bin\javac.exe’

Make sure you have both Android SDK & Java JDK installed in your machine:

(Which you probably do, otherwise you couldn’t build for android)

Make sure that you have pointed Unity to the correct path:


4. Add the Android SDK path to Unity

The first time you build a project for
Android (or if Unity later fails to
locate the SDK) you will be asked to
locate the folder where you installed
the Android SDK (you should select the
root folder of the SDK installation).
The location of the Android SDK can
also be changed in the editor by
selecting Unity > Preferences from the
menu and then clicking on External
Tools in the preferences window.


If this doesn’t help, take a look at this discussion on UnityAds forum:
http://forum.unity3d.com/threads/game-wont-build-after-importing-unity-ads.270615/

(problem related to having a 64-bit JDK versus 32-bit JDK)

Cheers,
Heikki

  • Update to the latest version of Unity 3D
  • If you have Services (ads) enabled with Unity 3D Ads Asset: remove Unity Ads Asset and Disable Services
  • If you had DoozyUI enabled at the sametime: remove DoozyUI form project
  • Redownload DoozyUI
  • Enable Services (ads)

This worked for me.