Search Unity

"Failed to recompile android resource files" after adding Unity Ads

Discussion in 'Unity Ads' started by cristicristi8160, Jun 22, 2016.

  1. cristicristi8160

    cristicristi8160

    Joined:
    May 7, 2016
    Posts:
    17
    Hello!

    I've added Unity Ads using this tutorial

    It showed the ads (testing turned on) in the Game View and basically everything worked well.
    But after building I got this message "Failed to recompile android resource files. See the console for details.".

    So I tried to add Unity Ads using a more professional tutorial made by Unity

    And I get the same error.

    Before these Ads, I could build without any error.

    These are the console messages:

    CommandInvokationFailure: Failed to recompile android resource files. See the Console for details.
    E:\Java\bin\javac.exe -bootclasspath "C:/Users/Cristi/AppData/Local/Android/sdk\platforms\android-23\android.jar" -d "E:\Rolling\Rolling\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "com\cizmar\tdba\R.java" "com\unity3d\ads\android\R.java"
    stderr[
    Error: Could not find or load main class com.sun.tools.javac.Main
    ]
    stdout[
    ]
    UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg)
    UnityEditor.Android.PostProcessAndroidPlayer.Exec (System.String command, System.String args, System.String workingdir, System.String[] progress_strings, Single progress_value, System.String errorMsg)
    UnityEditor.Android.PostProcessAndroidPlayer.CompileResources (System.String stagingArea, System.String packageName, UnityEditor.Android.AndroidLibraries androidLibraries)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
    UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry)
    UnityEditor.HostView:OnGUI()

    and

    Error building Player: CommandInvokationFailure: Failed to recompile android resource files. See the Console for details.
    E:\Java\bin\javac.exe -bootclasspath "C:/Users/Cristi/AppData/Local/Android/sdk\platforms\android-23\android.jar" -d "E:\Rolling\Rolling\Temp\StagingArea\bin\classes" -source 1.6 -target 1.6 -encoding UTF-8 "com\cizmar\tdba\R.java" "com\unity3d\ads\android\R.java"
    stderr[
    Error: Could not find or load main class com.sun.tools.javac.Main
    ]
    stdout[
    ]

    Can somebody help me?
     
  2. rasmus-unity

    rasmus-unity

    Unity Technologies

    Joined:
    Aug 15, 2014
    Posts:
    1,168
    Haven't seen this. Can you please report a bug using the "Help->Report a Bug" menu item and write the bug id here? (not the full url) You should get the id in mail within ~10 mins after you submit the bug.

    Thanks,
    Rasmus
     
  3. cristicristi8160

    cristicristi8160

    Joined:
    May 7, 2016
    Posts:
    17
    Problem was a bad JAVA_HOME path value...
     
  4. karim7

    karim7

    Joined:
    Mar 8, 2015
    Posts:
    4
    How you fix it I have same problem plz HELP ME
     
  5. clareblue79

    clareblue79

    Joined:
    Nov 9, 2015
    Posts:
    1
    For anyone having the same issue: Make sure to download the latest JDK and go to Unity-> Preferences-> External Tools -> then for the JDK path, click browse to relocate your HOME path that of the JDK you just installed,
     
    rasmus-unity likes this.
  6. ZzappSizzler

    ZzappSizzler

    Joined:
    Jan 15, 2017
    Posts:
    33
    Fixed it for me! Thanks clareblue79!