Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Not using Unity Analytics, but it crashes my game on Android

Discussion in 'Unity Analytics' started by Agodesa, Apr 9, 2020.

  1. Agodesa

    Agodesa

    Joined:
    Aug 3, 2017
    Posts:
    11
    Hello, everybody,

    I am working on an already quite complex project, where I am deploying to Android and iOS. I am offering a Demo version of the game for Google Instant Play. This version should be as lightweight as possible, because Google's max size for these kind of apps is around 15 MB.

    I am using Firebase Analytics, and not Unity Analytics.

    Now, for my Demo version, I am completely excluding Firebase (doing so with an Editor script). So far so good, until I build and test the game on Android. It crashes right after the splashscreen fades away.

    After debugging it with Logcat, I find these lines:

    Code (CSharp):
    1. 2020-04-08 19:54:43.369 8775-8803/com.company.name E/Unity: Unable to find type [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.Analytics.AnalyticsSessionInfo
    2.     (Filename: ./Runtime/Scripting/CommonScriptingClasses.cpp Line: 126)
    3. 2020-04-08 19:54:43.370 8775-8803/com.company.name E/Unity: Unable to find method CallIdentityTokenChanged in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.Analytics.AnalyticsSessionInfo
    4.     (Filename: ./Runtime/Scripting/CommonScriptingClasses.cpp Line: 143)
    5. 2020-04-08 19:54:43.371 8775-8803/com.company.name E/Unity: Unable to find method CallSessionStateChanged in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.Analytics.AnalyticsSessionInfo
    6.     (Filename: ./Runtime/Scripting/CommonScriptingClasses.cpp Line: 143)
    7. 2020-04-08 19:54:43.371 8775-8803/com.company.name E/Unity: Unable to find type [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.Analytics.AnalyticsSessionState
    8.     (Filename: ./Runtime/Scripting/CommonScriptingClasses.cpp Line: 126)
    9. 2020-04-08 19:54:43.372 8775-8803/com.company.name E/Unity: Unable to find type [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.Analytics.ContinuousEvent
    10.     (Filename: ./Runtime/Scripting/CommonScriptingClasses.cpp Line: 126)
    11. 2020-04-08 19:54:43.373 8775-8803/com.company.name E/Unity: Unable to find method RemoteConfigSettingsUpdated in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.RemoteConfigSettings
    12.     (Filename: ./Runtime/Scripting/CommonScriptingClasses.cpp Line: 143)
    13. 2020-04-08 19:54:43.374 8775-8803/com.company.name E/Unity: Unable to find type [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.RemoteConfigSettingsHelper/Tag
    14.     (Filename: ./Runtime/Scripting/CommonScriptingClasses.cpp Line: 126)
    15. 2020-04-08 19:54:43.374 8775-8803/com.company.name E/Unity: Unable to find method RemoteSettingsBeforeFetchFromServer in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.RemoteSettings
    16.     (Filename: ./Runtime/Scripting/CommonScriptingClasses.cpp Line: 143)
    17. 2020-04-08 19:54:43.375 8775-8803/com.company.name E/Unity: Unable to find method RemoteSettingsUpdateCompleted in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.RemoteSettings
    18.     (Filename: ./Runtime/Scripting/CommonScriptingClasses.cpp Line: 143)
    19. 2020-04-08 19:54:43.376 8775-8803/com.company.name E/Unity: Unable to find method RemoteSettingsUpdated in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.RemoteSettings
    20.     (Filename: ./Runtime/Scripting/CommonScriptingClasses.cpp Line: 143)

    Seeing Unity Analytics all over the place really confused me, because I am not using this package (I have even disabled it from the Package Manager). So, next step was testing another build with Unity Analytics enabled. IT WORKED.

    For some reason, this bug appeared after I removed Firebase, and not before. Might Firebase use Unity Analytics?

    Also important to mention, this problem doesn't happen if I don't enable Strip Engine Code. However, I aim to have this enabled.

    I am wondering if this might be a bug from Unity. Could someone assist me?

    I am including as an attachment, the complete crash log from Android Studio's Logcat.

    Some more info:
    • Unity 2019.3.3f1
    • IL2CPP
    • Firebase modules: Analytics, Crashlytics & Functions (6.13.0)
     

    Attached Files:

  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Agodesa likes this.
  3. Agodesa

    Agodesa

    Joined:
    Aug 3, 2017
    Posts:
    11
    After some testing, I think I know what the problem is.

    I have Unity Plus, and I am disabling the Unity Logo Splashscreen as well as signing in to link my project with Unity Services (so I can use my seat).

    So, let's review the test cases I performed (all of these exclude Firebase from the project completely):
    • No Unity Analytics: my game crashes (described before).
    • With Unity Analytics or Code Stripping disabled: game works.
    • Sign off of Unity Services and remove Unity Analytics: game works, but Unity's splashscreen is added.
    I also used the tool Charles to monitor this assertions, they match accordingly.

    Now, I have a question for you: is this a bug or it is meant to behave like that?

    By the way, I have Analytics turned off in the Services configuration.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I personally am not aware of this behavior. Please provide the Charles captures for analysis, and please provide steps to reproduce on a new project. A project without Analytics doesn't crash for me, for example.
     
  5. Agodesa

    Agodesa

    Joined:
    Aug 3, 2017
    Posts:
    11
    Ok, I was able to reproduce this on a new project. Here is the link to its source, with a built APK already in there: https://github.com/sdegetaus/unity-no-analytics-test

    In the repo, I include the session for the crash I get from running that APK.

    Steps to reproduce on a new project:
    • Remove Unity Analytics from the Package Manager.
    • Link your project to the Unity Services.
    • Enable Strip Engine and set it to the highest.
    • Don't know if these might affect but I mention them anyway:
      • IL2CPP
      • .NET Standard 2.0
      • Compiler Config Master
      • Both ARMv7 & ARM64
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    There is no need to remove Unity Analytics from the Package Manager. You enable/disable Analytics in the Services window. Please try your test without doing so.
     
  7. Agodesa

    Agodesa

    Joined:
    Aug 3, 2017
    Posts:
    11
    In that case, as I said, the game doesn't crash. But I am trying to remove all the unused Unity Built-in packages from my project, and I don't see why Unity Analytics should be the exception (so far I have been able to remove most of them).

    Thanks for the help!
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Understood, as you originally stated, sorry about that. We are following up.
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you elaborate what you mean by "Remove Analytics from Package Manager". On a brand new project, it's not installed. It's in the list of available packages however when I choose to view "All Packages". You have to explicitly install it.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  11. Agodesa

    Agodesa

    Joined:
    Aug 3, 2017
    Posts:
    11
    Setting the adequate options to 0 instead of 1 solved this! Thanks for your support :)

    Just one more question, in my Services window everything is set to OFF. Where are these options, like CrashReporting, AdsInitOnStartup, etc, located (like an Editor Window)?

    Btw, some settings from the UnityConnectSettings.asset get enabled by just "previewing" them. For example, if I click on Ads (without setting it to ON), CrashReporting gets automatically set to 1 :/
     
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, this is something you will want to keep watch for at this time. You can edit the file directly, it gets updated when you Save the project.
     
    Agodesa likes this.
  13. Agodesa

    Agodesa

    Joined:
    Aug 3, 2017
    Posts:
    11
    Ok, thanks a lot for your help!
    I am deleting the repo soon.
     
    JeffDUnity3D likes this.
  14. tazerg

    tazerg

    Joined:
    Oct 21, 2017
    Posts:
    15
    Hey!
    Faced the same problem.
    The steps for reproduction are the same. The app crashes right after the loading screen. The following fields are exposed in UnityConnectSettings.asset:

    Code (CSharp):
    1. UnityAnalyticsSettings:
    2.     m_Enabled: 0
    3.     m_TestMode: 0
    4.     m_InitializeOnStartup: 0
    Unity 2021.1.15f1
    How to solve the problem?
     
  15. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Analytics is not enabled as you can see. You can always check in Package Manager if you have the Analytics package installed.
     
  16. tazerg

    tazerg

    Joined:
    Oct 21, 2017
    Posts:
    15
    I don't have any installed Analytics package. This is all my dependencies.

    Code (CSharp):
    1. {
    2.   "dependencies": {
    3.     "com.unity.ads": "3.7.3",
    4.     "com.unity.ide.rider": "3.0.7",
    5.     "com.unity.mobile.android-logcat": "1.2.2",
    6.     "com.unity.mobile.notifications": "1.4.1",
    7.     "com.unity.test-framework": "1.1.27",
    8.     "com.unity.ugui": "1.0.0",
    9.     "com.unity.modules.androidjni": "1.0.0",
    10.     "com.unity.modules.animation": "1.0.0",
    11.     "com.unity.modules.imgui": "1.0.0",
    12.     "com.unity.modules.jsonserialize": "1.0.0",
    13.     "com.unity.modules.ui": "1.0.0",
    14.     "com.unity.modules.unitywebrequest": "1.0.0"
    15.   }
    16. }
     
    Last edited: Jul 20, 2021
  17. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Why do you believe the crash reports are related to Analytics? Did you see the previous post that mentioned removing Crash Reporting?
     
    Last edited: Jul 20, 2021
  18. tazerg

    tazerg

    Joined:
    Oct 21, 2017
    Posts:
    15
    Because I see it in the crash logs
    Code (CSharp):
    1. 2021.07.20 18:57:24.450 Unity Unable to find type [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.Analytics.AnalyticsSessionInfo
    2. 2021.07.20 18:57:24.453 Unity Unable to find method CallIdentityTokenChanged in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.Analytics.AnalyticsSessionInfo
    3. 2021.07.20 18:57:24.454 Unity Unable to find method CallSessionStateChanged in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.Analytics.AnalyticsSessionInfo
    4. 2021.07.20 18:57:24.455 Unity Unable to find type [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.Analytics.AnalyticsSessionState
    5. 2021.07.20 18:57:24.456 Unity Unable to find type [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.Analytics.ContinuousEvent
    6. 2021.07.20 18:57:24.457 Unity Unable to find method RemoteConfigSettingsUpdated in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.RemoteConfigSettings
    7. 2021.07.20 18:57:24.458 Unity Unable to find type [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.RemoteConfigSettingsHelper/Tag
    8. 2021.07.20 18:57:24.458 Unity Unable to find method RemoteSettingsBeforeFetchFromServer in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.RemoteSettings
    9. 2021.07.20 18:57:24.459 Unity Unable to find method RemoteSettingsUpdateCompleted in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.RemoteSettings
    10. 2021.07.20 18:57:24.459 Unity Unable to find method RemoteSettingsUpdated in [UnityEngine.UnityAnalyticsModule.dll]UnityEngine.RemoteSettings
    11.  
     
  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please see this previous post https://forum.unity.com/threads/not...ashes-my-game-on-android.863710/#post-5692225
     
  20. tazerg

    tazerg

    Joined:
    Oct 21, 2017
    Posts:
    15
    I do not fully understand what CrashReporting is about. If we are talking about CrashReportingSettings in UnityConnectSettings.asset, then I have it turned off.
    Here is the full text from UnityConnectSettings.asset (replaced advertising IDs with 0000):
    Code (CSharp):
    1. %YAML 1.1
    2. %TAG !u! tag:unity3d.com,2011:
    3. --- !u!310 &1
    4. UnityConnectSettings:
    5.   m_ObjectHideFlags: 0
    6.   serializedVersion: 1
    7.   m_Enabled: 1
    8.   m_TestMode: 0
    9.   m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
    10.   m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
    11.   m_ConfigUrl: https://config.uca.cloud.unity3d.com
    12.   m_DashboardUrl: https://dashboard.unity3d.com
    13.   m_TestInitMode: 0
    14.   CrashReportingSettings:
    15.     m_EventUrl: https://perf-events.cloud.unity3d.com
    16.     m_Enabled: 0
    17.     m_LogBufferSize: 10
    18.     m_CaptureEditorExceptions: 1
    19.   UnityPurchasingSettings:
    20.     m_Enabled: 0
    21.     m_TestMode: 0
    22.   UnityAnalyticsSettings:
    23.     m_Enabled: 0
    24.     m_TestMode: 0
    25.     m_InitializeOnStartup: 0
    26.   UnityAdsSettings:
    27.     m_Enabled: 1
    28.     m_InitializeOnStartup: 1
    29.     m_TestMode: 0
    30.     m_IosGameId:
    31.     m_AndroidGameId: 0000
    32.     m_GameIds:
    33.       AndroidPlayer: 0000
    34.       iPhonePlayer: 0000
    35.     m_GameId: 0000
    36.   PerformanceReportingSettings:
    37.     m_Enabled: 0
     
  21. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Looks correct. Can you provide steps to reproduce? What platform are you building on, and what device are you testing on?
     
  22. Justin-Wasilenko

    Justin-Wasilenko

    Joined:
    Mar 10, 2015
    Posts:
    103
    Really happy to have found this thread. I ran into the same issue in Unity 2021.2.f7 and was causing my android builds to crash.
    I did not have Unity Analytics installed, however it was set to ON in the services window. It wasn't until I created a Project ID for my project that I was allowed to set Analytics to off in the Services window. Once I was able to turn Analytics to off, the android build performed as it should.
     
  23. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Analytics requires a ProjectID, so when you turned it on, it should have generated the ProjectID then. Can you reproduce your flow with a new project?