Unity AdMob - ClassNotFound: com.google.unity.ads.UnityAdListener

Multi tool use
Multi tool use












2















My app is getting the following error when trying to load or show interstitial ad via AdMob for Unity: ClassNotFoundException: com.google.unity.ads.UnityAdListener.



AndroidJavaException: java.lang.ClassNotFoundException: com.google.unity.ads.UnityAdListener
java.lang.ClassNotFoundException: com.google.unity.ads.UnityAdListener
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
at android.os.MessageQueue.next(MessageQueue.java:394)
at android.os.Looper.loop(Looper.java:142)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.unity.ads.UnityAdListener"


My main advertisment code is:



public class AdsTest : MonoBehaviour
{
private InterstitialAd interstitial;

public void LoadAd()
{
string adUnitId = "ca-app-pub-3940256099942544/1033173712";
interstitial = new InterstitialAd(adUnitId);

interstitial.OnAdLoaded += HandleOnAdLoaded;
interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad;
interstitial.OnAdOpening += HandleOnAdOpened;
interstitial.OnAdClosed += HandleOnAdClosed;
interstitial.OnAdLeavingApplication += HandleOnAdLeavingApplication;

AdRequest request = new AdRequest.Builder().Build();
interstitial.LoadAd(request);
}

public void ShowAd()
{
if (interstitial.IsLoaded())
{
interstitial.Show();
}
}
...
}


The rest of the AdsTest class are the standard event voids (OnAdLoaded, OnAdClosed, ect.), the same as they're in Google's docs.



Calling the ads script from another class:



void OnTriggerEnter2D(Collider2D trigger)
{
ReturnToStart();
// where ads is a instance of the AdsTest class
// ads = new AdsTest();
ads.LoadAd();
ads.ShowAd();
}


And I've initialized the AdMob Id at the beginning of the game in a controller object.



// executed when the app starts
string appId = "ca-app-pub-3522556458609123~3670809634";
MobileAds.Initialize(appId);


I've imported all the assets from the unity-package and force resolved the play services dependencies.



Also my AndroidManifest looks like this:



screenshot



Environment and versioning:



Unity - 2018.3.0f2 Personal for Windows 10 x64



Android SDK - 27



AdMob Plugin - v3.15.1 (downloaded from Github)



java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) Client VM (build 25.191-b12, mixed mode, sharing)


Play services - as installed via the Admob package



Tested on Android 8.1, API 27



emulator specs










share|improve this question























  • github.com/googleads/googleads-mobile-unity/issues/347 may be of interest.

    – mjwills
    Dec 30 '18 at 11:42
















2















My app is getting the following error when trying to load or show interstitial ad via AdMob for Unity: ClassNotFoundException: com.google.unity.ads.UnityAdListener.



AndroidJavaException: java.lang.ClassNotFoundException: com.google.unity.ads.UnityAdListener
java.lang.ClassNotFoundException: com.google.unity.ads.UnityAdListener
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
at android.os.MessageQueue.next(MessageQueue.java:394)
at android.os.Looper.loop(Looper.java:142)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.unity.ads.UnityAdListener"


My main advertisment code is:



public class AdsTest : MonoBehaviour
{
private InterstitialAd interstitial;

public void LoadAd()
{
string adUnitId = "ca-app-pub-3940256099942544/1033173712";
interstitial = new InterstitialAd(adUnitId);

interstitial.OnAdLoaded += HandleOnAdLoaded;
interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad;
interstitial.OnAdOpening += HandleOnAdOpened;
interstitial.OnAdClosed += HandleOnAdClosed;
interstitial.OnAdLeavingApplication += HandleOnAdLeavingApplication;

AdRequest request = new AdRequest.Builder().Build();
interstitial.LoadAd(request);
}

public void ShowAd()
{
if (interstitial.IsLoaded())
{
interstitial.Show();
}
}
...
}


The rest of the AdsTest class are the standard event voids (OnAdLoaded, OnAdClosed, ect.), the same as they're in Google's docs.



Calling the ads script from another class:



void OnTriggerEnter2D(Collider2D trigger)
{
ReturnToStart();
// where ads is a instance of the AdsTest class
// ads = new AdsTest();
ads.LoadAd();
ads.ShowAd();
}


And I've initialized the AdMob Id at the beginning of the game in a controller object.



// executed when the app starts
string appId = "ca-app-pub-3522556458609123~3670809634";
MobileAds.Initialize(appId);


I've imported all the assets from the unity-package and force resolved the play services dependencies.



Also my AndroidManifest looks like this:



screenshot



Environment and versioning:



Unity - 2018.3.0f2 Personal for Windows 10 x64



Android SDK - 27



AdMob Plugin - v3.15.1 (downloaded from Github)



java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) Client VM (build 25.191-b12, mixed mode, sharing)


Play services - as installed via the Admob package



Tested on Android 8.1, API 27



emulator specs










share|improve this question























  • github.com/googleads/googleads-mobile-unity/issues/347 may be of interest.

    – mjwills
    Dec 30 '18 at 11:42














2












2








2








My app is getting the following error when trying to load or show interstitial ad via AdMob for Unity: ClassNotFoundException: com.google.unity.ads.UnityAdListener.



AndroidJavaException: java.lang.ClassNotFoundException: com.google.unity.ads.UnityAdListener
java.lang.ClassNotFoundException: com.google.unity.ads.UnityAdListener
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
at android.os.MessageQueue.next(MessageQueue.java:394)
at android.os.Looper.loop(Looper.java:142)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.unity.ads.UnityAdListener"


My main advertisment code is:



public class AdsTest : MonoBehaviour
{
private InterstitialAd interstitial;

public void LoadAd()
{
string adUnitId = "ca-app-pub-3940256099942544/1033173712";
interstitial = new InterstitialAd(adUnitId);

interstitial.OnAdLoaded += HandleOnAdLoaded;
interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad;
interstitial.OnAdOpening += HandleOnAdOpened;
interstitial.OnAdClosed += HandleOnAdClosed;
interstitial.OnAdLeavingApplication += HandleOnAdLeavingApplication;

AdRequest request = new AdRequest.Builder().Build();
interstitial.LoadAd(request);
}

public void ShowAd()
{
if (interstitial.IsLoaded())
{
interstitial.Show();
}
}
...
}


The rest of the AdsTest class are the standard event voids (OnAdLoaded, OnAdClosed, ect.), the same as they're in Google's docs.



Calling the ads script from another class:



void OnTriggerEnter2D(Collider2D trigger)
{
ReturnToStart();
// where ads is a instance of the AdsTest class
// ads = new AdsTest();
ads.LoadAd();
ads.ShowAd();
}


And I've initialized the AdMob Id at the beginning of the game in a controller object.



// executed when the app starts
string appId = "ca-app-pub-3522556458609123~3670809634";
MobileAds.Initialize(appId);


I've imported all the assets from the unity-package and force resolved the play services dependencies.



Also my AndroidManifest looks like this:



screenshot



Environment and versioning:



Unity - 2018.3.0f2 Personal for Windows 10 x64



Android SDK - 27



AdMob Plugin - v3.15.1 (downloaded from Github)



java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) Client VM (build 25.191-b12, mixed mode, sharing)


Play services - as installed via the Admob package



Tested on Android 8.1, API 27



emulator specs










share|improve this question














My app is getting the following error when trying to load or show interstitial ad via AdMob for Unity: ClassNotFoundException: com.google.unity.ads.UnityAdListener.



AndroidJavaException: java.lang.ClassNotFoundException: com.google.unity.ads.UnityAdListener
java.lang.ClassNotFoundException: com.google.unity.ads.UnityAdListener
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:453)
at java.lang.Class.forName(Class.java:378)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source:72)
at android.os.MessageQueue.next(MessageQueue.java:394)
at android.os.Looper.loop(Looper.java:142)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:32)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.unity.ads.UnityAdListener"


My main advertisment code is:



public class AdsTest : MonoBehaviour
{
private InterstitialAd interstitial;

public void LoadAd()
{
string adUnitId = "ca-app-pub-3940256099942544/1033173712";
interstitial = new InterstitialAd(adUnitId);

interstitial.OnAdLoaded += HandleOnAdLoaded;
interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad;
interstitial.OnAdOpening += HandleOnAdOpened;
interstitial.OnAdClosed += HandleOnAdClosed;
interstitial.OnAdLeavingApplication += HandleOnAdLeavingApplication;

AdRequest request = new AdRequest.Builder().Build();
interstitial.LoadAd(request);
}

public void ShowAd()
{
if (interstitial.IsLoaded())
{
interstitial.Show();
}
}
...
}


The rest of the AdsTest class are the standard event voids (OnAdLoaded, OnAdClosed, ect.), the same as they're in Google's docs.



Calling the ads script from another class:



void OnTriggerEnter2D(Collider2D trigger)
{
ReturnToStart();
// where ads is a instance of the AdsTest class
// ads = new AdsTest();
ads.LoadAd();
ads.ShowAd();
}


And I've initialized the AdMob Id at the beginning of the game in a controller object.



// executed when the app starts
string appId = "ca-app-pub-3522556458609123~3670809634";
MobileAds.Initialize(appId);


I've imported all the assets from the unity-package and force resolved the play services dependencies.



Also my AndroidManifest looks like this:



screenshot



Environment and versioning:



Unity - 2018.3.0f2 Personal for Windows 10 x64



Android SDK - 27



AdMob Plugin - v3.15.1 (downloaded from Github)



java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) Client VM (build 25.191-b12, mixed mode, sharing)


Play services - as installed via the Admob package



Tested on Android 8.1, API 27



emulator specs







c# android unity3d admob






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 30 '18 at 11:32









Radi ChoRadi Cho

534




534













  • github.com/googleads/googleads-mobile-unity/issues/347 may be of interest.

    – mjwills
    Dec 30 '18 at 11:42



















  • github.com/googleads/googleads-mobile-unity/issues/347 may be of interest.

    – mjwills
    Dec 30 '18 at 11:42

















github.com/googleads/googleads-mobile-unity/issues/347 may be of interest.

– mjwills
Dec 30 '18 at 11:42





github.com/googleads/googleads-mobile-unity/issues/347 may be of interest.

– mjwills
Dec 30 '18 at 11:42












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53977246%2funity-admob-classnotfound-com-google-unity-ads-unityadlistener%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53977246%2funity-admob-classnotfound-com-google-unity-ads-unityadlistener%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







NJib8teox7r v7j88 niKKCmS GFrcLs H5O,tag 7
UpSHipfUuz0kLIUhDTw39ea t qhUhSAIfj,ueE,g,LsZy7UyB,w3,ggeP,greAS8O1QJ BJX2X ciBvair,Fs1EihbaSd IBjh dPvCD

Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas