Hi all, i’ve just finished to create my first android game, and i’m getting this error when i try to build with the Unity Ads Service turend on. That’s is real borning! 2 Months to finish the game and i’m get this issue
So i’ve simple enabled the unity Ads service and create just 2 scripts
This for Initializer
using UnityEngine;
using UnityEngine.Advertisements;
public class UnityAdsInitializer : MonoBehaviour
{
[SerializeField]
private string
androidGameId = "17564",
iosGameId = "17569";
[SerializeField]
private bool testMode;
void Start()
{
string gameId = null;
#if UNITY_ANDROID
gameId = androidGameId;
#elif UNITY_IOS
gameId = iosGameId;
#endif
if (Advertisement.isSupported && !Advertisement.isInitialized)
{
Advertisement.Initialize(gameId, testMode);
}
}
and this to show ads if show ad button is pressed
using UnityEngine;
using UnityEngine.Advertisements;
using System.Collections;
public class PlayAd : MonoBehaviour {
void Awake()
{
if(Advertisement.isSupported)
{
Advertisement.Initialize("1095237", false);
}
}
public void ShowAd()
{
if(Advertisement.IsReady() )
{
Advertisement.Show("rewardedVideo", new ShowOptions() { resultCallback = HandleAdResult});
}
}
private void HandleAdResult(ShowResult result)
{
switch (result)
{
case ShowResult.Finished:
Debug.Log("Player Has Watch All Ad");
break;
case ShowResult.Skipped:
Debug.Log("Player Has Skipped The Ad");
break;
case ShowResult.Failed:
Debug.Log("Player Has Failed To Launch App");
break;
}
}
}
Now when i try to build i’m getting this soo bad error:
Error building Player: CommandInvokationFailure: Unable to convert classes into dex format. See the Console for details.
C:/Program Files (x86)/Java/jdk1.7.0_79\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="C:/Users/Mattia/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/dx/command/Main : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at SDKMain.main(SDKMain.java:127)
]
stdout[
]
I really need help, cause i’m stuck on this error from alredy 4 days… Thanks in advice