Unity error after adding ads Failed to recompile android resource files. How to fix?

Like it says in the title the game built and ran perfect before i added in Unity ads following the Unity documentation https://docs.unity3d.com/Manual/UnityAdsHowTo.html

Things ive tried so far

  • Deleting 24.0.0 from build tools in the android sdk
  • Updating the android sdk

the console reads:

Failed to compile resources with the following parameters:
-bootclasspath “C:/Users/MyName/Desktop/android-sdk_r24.4.1-windows/android-sdk-windows\platforms\android-24\android.jar” -d “C:\Users\MyName\Desktop\TestGame\Temp\StagingArea\bin\classes” -source 1.6 -target 1.6 -encoding UTF-8 “com\GenricName24\TestGame\R.java” “com\unity3d\ads\android\R.java”
warning: C:\Users\MyName\Desktop\android-sdk_r24.4.1-windows\android-sdk-windows\platforms\android-24\android.jar(java/lang/Object.class): major version 52 is newer than 51, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: C:\Users\MyName\Desktop\android-sdk_r24.4.1-windows\android-sdk-windows\platforms\android-24\android.jar(java/lang/AutoCloseable.class): major version 52 is newer than 51, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
2 warnings

UnityEditor.HostView:OnGUI()

You should install JDK 8. After you install it, you should make sure that Unity will use that particular version (you can help multiple different JDKs installed on the same machine).

This is done from the Preferences menu (under External Tools). Once you set that up, try to build again. It should work this time :slight_smile: