Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Fatal exception: java.lang.Error / Caused by java.lang.NullPointerException

Discussion in 'Unity Ads & User Acquisition' started by cdr9042, Apr 9, 2020.

  1. cdr9042

    cdr9042

    Joined:
    Apr 22, 2018
    Posts:
    162
    My Firebase Crashlytic caught crashes like this on devices of my users. Here's the details

    Fatal Exception: java.lang.Error: FATAL EXCEPTION [main]
    Unity version : 2019.3.0f6
    Device model : samsung SM-J700H
    (also happens on some other devices like Oppo X909)



    Stack trace:
    Code (csharp):
    1. Caused by java.lang.NullPointerException: Expected to unbox a 'int' primitive type but was returned null
    2.        at $Proxy13.hashCode()
    3.        at java.util.Collections.secondaryHash(Collections.java:3427)
    4.        at java.util.HashMap.put(HashMap.java:386)
    5.        at java.util.HashSet.add(HashSet.java:95)
    6.        at java.util.LinkedHashSet.<init>(LinkedHashSet.java:82)
    7.        at com.unity3d.ads.properties.AdsProperties.getListeners(AdsProperties.java:47)
    8.        at com.unity3d.services.ads.api.Listener$5.run(Listener.java:76)
    9.        at android.os.Handler.handleCallback(Handler.java:739)
    10.        at android.os.Handler.dispatchMessage(Handler.java:95)
    11.        at android.os.Looper.loop(Looper.java:148)
    12.        at android.app.ActivityThread.main(ActivityThread.java:7223)
    13.        at java.lang.reflect.Method.invoke(Method.java)
    14.        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    15.        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
     
    Last edited: Apr 9, 2020
  2. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    Hi @cdr9042,

    I'd like to investigate this. Can you send this information to the Unity Ads Support email?
    unityads-support@unity3d.com

    If you could also include a link to a build of your game that would be helpful, so we can try to reproduce it. If you have any other information that might help us reproduce or diagnose the issue, that would also be useful.
     
  3. cdr9042

    cdr9042

    Joined:
    Apr 22, 2018
    Posts:
    162
    I have sent the information to your email address
     
  4. hassan_93

    hassan_93

    Joined:
    Apr 11, 2017
    Posts:
    2
    any progress on this? I am facing an issue with an almost identical stack trace. Everywhere else I have only found issues with google ads but that is not relevant to my issue.

    can the issue be solved by simply updating the unity ads plugin?
     
    erdogan_akgun likes this.
  5. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    @hassan_93 Could you post the exact stack trace you're getting?
     
  6. erdogan_akgun

    erdogan_akgun

    Joined:
    Aug 28, 2018
    Posts:
    8
  7. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    @erdogan_akgun There's a known issue when calling removeListener in recent versions of the SDK that can occasionally cause a crash on some devices. We're working on a fix, but in the meantime you may wish to downgrade to an earlier version of the SDK - 3.4.2 hasn't shown any signs of this error so far.
     
    erdogan_akgun likes this.
  8. erdogan_akgun

    erdogan_akgun

    Joined:
    Aug 28, 2018
    Posts:
    8
    Thanks to answer. Non-fatal caused by removeListener, right. What about the crash? Same stack trace within this thread. Crash when calling getListeners as I see. Is this also a known issue? Will it be fixed in the next releases?
     
  9. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    @erdogan_akgun We need more info to say for sure what is causing your issue. Can you create a support ticket and provide as much information about your project as possible?
     
  10. hassan_93

    hassan_93

    Joined:
    Apr 11, 2017
    Posts:
    2
    Here you go, looks like an issue with unity ads but I have not been able to fix it as yet.

    Code (CSharp):
    1. java.lang.Error: FATAL EXCEPTION [main]
    2. Unity version     : 2018.3.13f1
    3. Device model      : samsung SM-A115F
    4. Device fingerprint: samsung/a11qnnxx/a11q:10/QP1A.190711.020/A115FXXU1ATG1:user/release-keys
    5. Caused by
    6.   at $Proxy11.hashCode (Unknown Source)
    7.   at java.util.HashMap.hash (HashMap.java:338)
    8.   at java.util.HashMap.put (HashMap.java:611)
    9.   at java.util.HashSet.add (HashSet.java:219)
    10.   at com.unity3d.ads.properties.AdsProperties.getListeners (AdsProperties.java:49)
    11.   at com.unity3d.services.ads.api.Listener$5.run (Listener.java:76)
    12.   at android.os.Handler.handleCallback (Handler.java:883)
    13.   at android.os.Handler.dispatchMessage (Handler.java:100)
    14.   at android.os.Looper.loop (Looper.java:237)
    15.   at android.app.ActivityThread.main (ActivityThread.java:7814)
    16.   at java.lang.reflect.Method.invoke (Native Method)
    17.   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
    18.   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1075)
    Code (CSharp):
    1. java.lang.Error: FATAL EXCEPTION [main]
    2. Unity version     : 2018.3.13f1
    3. Caused by
    4.   at $Proxy11.hashCode (Unknown Source)
    5.   at java.util.HashMap.hash (HashMap.java:338)
    6.   at java.util.HashMap.put (HashMap.java:611)
    7.   at java.util.HashSet.add (HashSet.java:219)
    8.   at com.unity3d.ads.properties.AdsProperties.getListeners (AdsProperties.java:49)
    9.   at com.unity3d.services.ads.configuration.AdsModuleConfiguration$3.run (AdsModuleConfiguration.java:91)
    10.   at android.os.Handler.handleCallback (Handler.java:873)
    11.   at android.os.Handler.dispatchMessage (Handler.java:99)
    12.   at android.os.Looper.loop (Looper.java:214)
    13.   at android.app.ActivityThread.main (ActivityThread.java:7156)
    14.   at java.lang.reflect.Method.invoke (Native Method)
    15.   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
    16.   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
     
  11. Alima-Studios

    Alima-Studios

    Joined:
    Nov 12, 2014
    Posts:
    78
    Same here

    unity monetization 3.4.8

    Code (CSharp):
    1. Samsung Galaxy J7 Prime (on7xltechn), 2816MB RAM, Android 6.0
    2. Informe 1
    3.  
    4. java.lang.Error: FATAL EXCEPTION [main]
    5. Unity version     : 2020.1.1f1
    6. Device model      : samsung SM-G610F
    7. Device fingerprint: samsung/on7xltezh/on7xltechn:6.0.1/MMB29M/G610FXXU1API4:user/release-keys
    8. Build Type        : Release
    9. Scripting Backend : IL2CPP
    10. ABI               : arm64-v8a
    11. Strip Engine Code : true
    12. Caused by
    13.   at $Proxy8.hashCode (Unknown Source)
    14.   at java.util.Collections.secondaryHash (Collections.java:3427)
    15.   at java.util.HashMap.put (HashMap.java:386)
    16.   at java.util.HashSet.add (HashSet.java:95)
    17.   at java.util.LinkedHashSet.<init> (LinkedHashSet.java:82)
    18.   at com.unity3d.ads.properties.AdsProperties.getListeners (AdsProperties.java:47)
    19.   at com.unity3d.services.ads.configuration.AdsModuleConfiguration$3.run (AdsModuleConfiguration.java:91)
    20.   at android.os.Handler.handleCallback (Handler.java:739)
    21.   at android.os.Handler.dispatchMessage (Handler.java:95)
    22.   at android.os.Looper.loop (Looper.java:148)
    23.   at android.app.ActivityThread.main (ActivityThread.java:7325)
    24.   at java.lang.reflect.Method.invoke (Native Method)
    25.   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
    26.   at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
     
  12. Alima-Studios

    Alima-Studios

    Joined:
    Nov 12, 2014
    Posts:
    78
    there is no way to select the version on the package manager
     
  13. kyle-unity

    kyle-unity

    Unity Technologies

    Joined:
    Jan 6, 2020
    Posts:
    336
    You can click "See all versions" in package manager to make previous versions appear, like so:

    Annotation 2020-08-19 135027.png
    Annotation 2020-08-19 135041.png
     
    Alima-Studios likes this.
  14. abbubakar_57

    abbubakar_57

    Joined:
    Nov 23, 2020
    Posts:
    12
    java.lang.Error: FATAL EXCEPTION [main]
    Unity version : 2019.4.10f1
    Device model : samsung SM-J600G
    Device fingerprint: samsung/j6ltedx/j6lte:10/QP1A.190711.020/J600GDXU6CTF4:user/release-keys
    Caused by
    at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3556)
    at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3703)
    at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:83)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2216)
    at android.os.Handler.dispatchMessage (Handler.java:107)
    at android.os.Looper.loop (Looper.java:237)
    at android.app.ActivityThread.main (ActivityThread.java:7948)
    at java.lang.reflect.Method.invoke (Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1075)
    Caused by: java.lang.SecurityException:
    at android.os.Parcel.createException (Parcel.java:2088)
    at android.os.Parcel.readException (Parcel.java:2056)
    at android.os.Parcel.readException (Parcel.java:2004)
    at android.app.IActivityTaskManager$Stub$Proxy.startActivity (IActivityTaskManager.java:4250)
    at android.app.Instrumentation.execStartActivity (Instrumentation.java:1713)
    at android.app.Activity.startActivityForResult (Activity.java:5250)
    at android.app.Activity.startActivityForResult (Activity.java:5208)
    at android.app.Activity.startActivity (Activity.java:5579)
    at android.app.Activity.startActivity (Activity.java:5547)
    at com.google.android.gms.ads.internal.util.q.N (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100057.336078696.336078696:2)
    at com.google.android.gms.ads.internal.overlay.a.a (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100057.336078696.336078696:3)
    at com.google.android.gms.ads.internal.overlay.a.b (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100057.336078696.336078696:3)
    at com.google.android.gms.ads.internal.overlay.s.d (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100057.336078696.336078696:6)
    at com.google.android.gms.ads.internal.overlay.client.b.bv (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100057.336078696.336078696:18)
    at fy.onTransact (com.google.android.gms.policy_ads_fdr_dynamite@204204100@204204100057.336078696.336078696:4)
    at android.os.Binder.transact (Binder.java:949)
    at com.google.android.gms.internal.ads.zzfn.zza
    at com.google.android.gms.internal.ads.zzanq.onCreate
    at com.google.android.gms.ads.AdActivity.onCreate
    at android.app.Activity.performCreate (Activity.java:7955)
    at android.app.Activity.performCreate (Activity.java:7944)
    at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1307)
    at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3531)
     
  15. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,772
    Alima-Studios and erdogan_akgun like this.
  16. canyon_gyh

    canyon_gyh

    Joined:
    Aug 15, 2018
    Posts:
    47
  17. msBinaryops

    msBinaryops

    Joined:
    Dec 3, 2022
    Posts:
    1
    this is Muhammad Saqib. I have solved this by just EXIT unity... go to source code folder. and delete the LIBRARY folder.. then again open the project in unity it will recreate all libraries.. and you wont face java.lang error anymore... thanks