after importing unity ads, the game will play fine in the editor, even loading the default dummy ad for testing, but will not build. gives error:
Error building Player: Win32Exception: ApplicationName=‘C:\Program Files (x86)\Java\jre1.8.0_20\bin\javac.exe’, CommandLine=‘-bootclasspath “C:/Users/C/Android SDK/sdk/platforms/android-20\android.jar” -d “C:\Users\C\Documents\MyGame\Temp\StagingArea\bin\classes” -source 1.6 -target 1.6 -encoding UTF-8 “com\unity3d\ads\android\R.java” “com\unity3d\tester\R.java”’, CurrentDirectory=‘C:\Users\C\Documents\MyGame\Temp\StagingArea\gen’
i have even deleted the game objects containing the ad scripts and still get error. cannot continue working on the project unless i delete all unity ads objects, but hoping there is a fix before i have to resort to that.
EDIT: deleted all unity ads folders and objects and game builds fine, so there is def. a problem with unity ads and android
Hmm, the mention of “game objects with ad scripts” is throwing a red flag for me. Are you using the latest version of the Unity Ads asset package? Before importing the new package, first delete the old package assets from your project.
Could you try it again with a fresh import of the asset package?
it was a fresh import from whatever asset was live in the unity store as of this morning. no old packages to delete. as for the GO’s, they were just buttons that referenced and turned on/off the ads. the scripts aren’t the problem as they play fine, the error occurs during build and is some kind of conflict with the android SDK.
EDIT: just reimported it again and made a build before touching anything after import and got the build error.
It seems that Unity is trying to build with Java Runtime Environment, and not with Android SDK.
Please check out this:
If you already have Android SDK setup, and still get this error make sure that Unity is actually using the correct path:
– (shameless copy & paste) – 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.
i have been building android games for a year now and this only became a problem when i imported unity ads and goes away immediately when i remove it, so that is not the issue, but ty.
however, it does use the JRE because unity ads is built into a .jar file.
however, if unity ads were looking for the JRE in the wrong location (i dont remember having an option to set it) or were erroneously using the JRE instead of the android SDK (and i have no inner knowledge of how the two communicate), then that could be the issue.
EDIT: in fact that IS the issue. there is no file by that name. no javac.exe. the java compiler is javacpl.exe. Good eyes, Heikki!
there was no PATH variable, so i create one that points to the java bin directory. however, it is still looking for a file that does not exist. there is no javac.exe: