AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.ads.initialization.OnInitializationCompleteListener
See original GitHub issueDescribe the problem
Steps to reproduce:
I build a project using Admob, it works fine with test app id, ad unit id. But when I release the app, no ads are shown. I test my application using LogCat, it shows these errors.
Relevant Code:
When App start this error is displayed in LogCat
AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.ads.initialization.OnInitializationCompleteListener
java.lang.ClassNotFoundException: com.google.android.gms.ads.initialization.OnInitializationCompleteListener
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:83)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:223)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.ads.initialization.OnInitializationCompleteListener
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:83)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:223)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <000000000000000000000
When I click the show ad button, this error is displayed
AndroidJavaException: java.lang.ClassNotFoundException: com.google.android.gms.ads.AdRequest$Builder
java.lang.ClassNotFoundException: com.google.android.gms.ads.AdRequest$Builder
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:83)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:223)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
Caused by: java.lang.ClassNotFoundException: com.google.android.gms.ads.AdRequest$Builder
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:454)
at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:83)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:223)
at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.AndroidJNISafe.FindClass (System.String name) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.AndroidJavaObject._AndroidJavaObject (System.String class
I have done Assets > Play Services Resolver > Android Resolver > Force Resolve like many tutorials but it doesn’t work.
My environment
- Unity version: 2020.3.40f1
- Google Mobile Ads Unity plugin version: 7.3.1
- Platform: Android
- Platform OS version: Android 5.0 to API level 31
- Any specific devices issue occurs on: All
- Mediation ad networks used, and their versions: None
Thank you
Issue Analytics
- State:
- Created 9 months ago
- Reactions:1
- Comments:14 (1 by maintainers)
Top Results From Across the Web
java.lang.ClassNotFoundException: com ...
I workaround and find out that, newest Google Mobile Ads Mediation have several code that call Java static com.google.android.gms.ads.initialization.
Read more >java.lang.ClassNotFoundException: com.google.android. ...
while i have try Android resolver version but its not fix it while if select force Android resolver version than i get gradle...
Read more >Can anybody explain me what is code mean in logcat?
Basically I get this line of code when I initialize the add and request for banner ad. Basically the test banner ad does...
Read more >Admob plugin error: Java.Lang.ClassNotFoundException
Good morning everyone, I have a problem with Admob, this is the first time this has happened to me. The ads work PERFECTLY...
Read more >Admob plugin error: Java.Lang.ClassNotFoundException ...
Since switching my build method from internal to gradle I can no longer get the admob plugin to work for unity, the following...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have this problem too.
Solution:
Build Settings > Player Setting > Publishing Settings > Custom Progurard File
proguard-user.txt:
work for unity 2022.3.3f1 thanks