Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

TypeLoadException: Could not load type 'UnityEngine.Analytics.AnalyticsEvent'

Discussion in 'Unity Analytics' started by MayhemMike, Dec 5, 2018.

  1. MayhemMike

    MayhemMike

    Joined:
    Oct 23, 2013
    Posts:
    46
    Performance reporting shows thousands of entries for this exception since I updated my app and I have no idea what could cause this.

    Here's the stack trace:

    System.Type.GetType (System.String typeName, Boolean throwOnError)
    UnityEngine.Monetization.Analytics.InitializeStandardEvents ()
    UnityEngine.Monetization.Analytics.SetAnalyticsEventExtra (System.String key, System.Object value)
    UnityEngine.Monetization.Analytics.SetAnalyticsEventExtra (System.String jsonExtras)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters)
    UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args)
    UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, IntPtr jmethodName, IntPtr jargs)
    UnityEngine._AndroidJNIHelper:InvokeJavaProxyMethod(AndroidJavaProxy, IntPtr, IntPtr)


    I'm using 2018.2.16f.
    Not a single user has complained about a crash so far, so not sure what is happening.
    Any idea what could cause this?
     
  2. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
    Hi,
    Can you reproduce this issue on your side?
    Could you please send me the game link on Google Play? I'd like to test it out.
    Thank you.
     
    MayhemMike likes this.
  3. MayhemMike

    MayhemMike

    Joined:
    Oct 23, 2013
    Posts:
    46
    Last edited: Dec 6, 2018
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,914
    @MayhemMike Can you share how you installed the plugin? Did you install from the assetstore? Do you have any other information from the error report such as Android vs iOS, OS version, etc?
     
  5. MayhemMike

    MayhemMike

    Joined:
    Oct 23, 2013
    Posts:
    46
    So I did some extensive digging now. Disclaimer: The Performance Report tool sometimes bugs out and returns no values when selecting filters, so I can't refine my search as much as I like.

    What I found: The error showed up before I implemented the data privacy plugin. It only triggers on the Androidplayer and not in the Editor. (I don't build for iOS). Going through my change logs, the only thing I did that could be relevant was change to il2cpp, upgrade Unity and add one new custom event.
    I tested it now with 2018.2.18f and removed the new event but the exception still gets triggered. According to the overview pretty much all Android versions are affected.
    Meanwhile values on the Analytics dashboard seem as usual.

    It might help to narrow it down if you guys could tell me in which context
    UnityEngine.Monetization.Analytics.InitializeStandardEvents ()
    gets called.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,914
    @MayhemMike We have identified the issue. It turns out that you can safely ignore the message, it's harmless. We are looking to address the issue in an upcoming release.
     
    McGravity and MayhemMike like this.
  7. MayhemMike

    MayhemMike

    Joined:
    Oct 23, 2013
    Posts:
    46
    great, thanks
     
  8. SimuSkippy

    SimuSkippy

    Joined:
    Oct 3, 2016
    Posts:
    5
    Found this error reported in our Cloud Analytics console after our QA team reported the app crashing on some devices (Huawei 6p, Google Pixel). We rolled our cloud build target back to 2017.4.16f1, which seemed to resolve the problem. Are you sure it's harmless?
     
  9. Uldis-Silins

    Uldis-Silins

    Joined:
    Apr 17, 2018
    Posts:
    1
    Same exception here on 2018.1.2f1 Android and iOS

    On iOS exception is:
    System.Exception: TypeLoadException: Could not load type 'UnityEngine.Analytics.AnalyticsEvent' from assembly 'Unity.Analytics.StandardEvents, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
    System.Type.GetType (System.String typeName, Boolean throwOnError)
    UnityEngine.Monetization.Analytics.InitializeStandardEvents ()
    UnityEngine.Monetization.Analytics.SetAnalyticsEventExtra (System.String key, System.Object value)
    UnityEngine.Monetization.Analytics.SetAnalyticsEventExtra (System.String jsonExtras)
    UnityEngine.Monetization.Analytics:SetAnalyticsEventExtra(String)
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,914
  11. lordnedox

    lordnedox

    Joined:
    Jan 7, 2016
    Posts:
    16
    Hi, what should we monitor for the upcoming release which includes this fix? Unity Ads 3 library, standard events, ads package.. or?

    I'm getting hundreds of these errors and though it "might" be harmless, it looks pretty scary in the crash reporting.
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,914
    The update would come in an upcoming Unity Editor release.
     
  13. MajidKhosravi

    MajidKhosravi

    Joined:
    Jun 21, 2013
    Posts:
    37
    I am still seeing this in the 2018.2.20f1 , any update on this issue?

    Thanks.
     
  14. studentutu

    studentutu

    Joined:
    Oct 22, 2017
    Posts:
    38
    Also, while using Unity Monetization plugin from Asset Store with built in Unity Ads - while building on Android I'm getting an exception in build phase - upload_2019-3-29_17-9-4.png

    Using : Unity 2018.2.21.f1, .Net 4.5, Firebase Database 5.6.0, Firebase Remote Config 5.6.0, Admob v3.16 , Google Play Games 0.9.62, Unity Monetization 3.0.3
    Here is a stacktrace :

    C:/Program Files/Java/jdk1.8.0_162\bin\java.exe -classpath "C:\Program Files\Unity\Hub\Editor\2018.2.21f1\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.2.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"

    stderr[

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':transformDexWithDexForRelease'.
    > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/unity3d/ads/BuildConfig;

    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    * Get more help at https://help.gradle.org

    BUILD FAILED in 8s
    ]
    stdout[
    :preBuild UP-TO-DATE
    :Firebase:preBuild UP-TO-DATE
    :Firebase:preReleaseBuild UP-TO-DATE
    :Firebase:checkReleaseManifest
    :Firebase:processReleaseManifest
    :GoogleMobileAdsPlugin:preBuild UP-TO-DATE
    :GoogleMobileAdsPlugin:preReleaseBuild UP-TO-DATE
    :GoogleMobileAdsPlugin:checkReleaseManifest
    :GoogleMobileAdsPlugin:processReleaseManifest
    :GooglePlayGamesManifest.plugin:preBuild UP-TO-DATE
    :GooglePlayGamesManifest.plugin:preReleaseBuild UP-TO-DATE
    :GooglePlayGamesManifest.plugin:checkReleaseManifest
    :GooglePlayGamesManifest.plugin:processReleaseManifest
    :preReleaseBuild
    :Firebase:compileReleaseAidl
    :GoogleMobileAdsPlugin:compileReleaseAidl
    :GooglePlayGamesManifest.plugin:compileReleaseAidl
    :compileReleaseAidl UP-TO-DATE
    :Firebase:packageReleaseRenderscript NO-SOURCE
    :GoogleMobileAdsPlugin:packageReleaseRenderscript NO-SOURCE
    :GooglePlayGamesManifest.plugin:packageReleaseRenderscript NO-SOURCE
    :compileReleaseRenderscript UP-TO-DATE
    :checkReleaseManifest UP-TO-DATE
    :generateReleaseBuildConfig UP-TO-DATE
    :prepareLintJar UP-TO-DATE
    :generateReleaseResValues UP-TO-DATE
    :generateReleaseResources UP-TO-DATE
    :Firebase:compileReleaseRenderscript
    :Firebase:generateReleaseResValues
    :Firebase:generateReleaseResources
    :Firebase:packageReleaseResources
    :GoogleMobileAdsPlugin:compileReleaseRenderscript
    :GoogleMobileAdsPlugin:generateReleaseResValues
    :GoogleMobileAdsPlugin:generateReleaseResources
    :GoogleMobileAdsPlugin:packageReleaseResources
    :GooglePlayGamesManifest.plugin:compileReleaseRenderscript
    :GooglePlayGamesManifest.plugin:generateReleaseResValues
    :GooglePlayGamesManifest.plugin:generateReleaseResources
    :GooglePlayGamesManifest.plugin:packageReleaseResources
    :mergeReleaseResources UP-TO-DATE
    :createReleaseCompatibleScreenManifests UP-TO-DATE
    :processReleaseManifest
    C:\Users\user\Documents\game-unity-wrod\WROD_2018\Temp\gradleOut\src\main\AndroidManifest.xml:24:9-31:50 Warning:
    activity#com.google.firebase.auth.internal.FederatedSignInActivity@android:launchMode was tagged at AndroidManifest.xml:24 to replace other declarations but no other declaration present
    :splitsDiscoveryTaskRelease UP-TO-DATE
    :Firebase:platformAttrExtractor
    :GoogleMobileAdsPlugin:platformAttrExtractor
    :GooglePlayGamesManifest.plugin:platformAttrExtractor
    :Firebase:generateReleaseBuildConfig
    :Firebase:prepareLintJar UP-TO-DATE
    :Firebase:javaPreCompileRelease
    :Firebase:processReleaseJavaRes NO-SOURCE
    :GoogleMobileAdsPlugin:generateReleaseBuildConfig
    :GoogleMobileAdsPlugin:prepareLintJar UP-TO-DATE
    :GoogleMobileAdsPlugin:javaPreCompileRelease
    :GoogleMobileAdsPlugin:processReleaseJavaRes NO-SOURCE
    :GooglePlayGamesManifest.plugin:generateReleaseBuildConfig
    :GooglePlayGamesManifest.plugin:prepareLintJar UP-TO-DATE
    :GooglePlayGamesManifest.plugin:javaPreCompileRelease
    :GooglePlayGamesManifest.plugin:processReleaseJavaRes NO-SOURCE
    :compileReleaseNdk NO-SOURCE
    :mergeReleaseShaders UP-TO-DATE
    :compileReleaseShaders UP-TO-DATE
    :generateReleaseAssets UP-TO-DATE
    :Firebase:mergeReleaseShaders
    :Firebase:compileReleaseShaders
    :Firebase:generateReleaseAssets
    :Firebase:mergeReleaseAssets
    :GoogleMobileAdsPlugin:mergeReleaseShaders
    :GoogleMobileAdsPlugin:compileReleaseShaders
    :GoogleMobileAdsPlugin:generateReleaseAssets
    :GoogleMobileAdsPlugin:mergeReleaseAssets
    :GooglePlayGamesManifest.plugin:mergeReleaseShaders
    :GooglePlayGamesManifest.plugin:compileReleaseShaders
    :GooglePlayGamesManifest.plugin:generateReleaseAssets
    :GooglePlayGamesManifest.plugin:mergeReleaseAssets
    :mergeReleaseAssets
    :mergeReleaseJniLibFolders UP-TO-DATE
    :Firebase:compileReleaseNdk NO-SOURCE
    :Firebase:mergeReleaseJniLibFolders
    :Firebase:transformNativeLibsWithMergeJniLibsForRelease
    :Firebase:transformNativeLibsWithIntermediateJniLibsForRelease
    :GoogleMobileAdsPlugin:compileReleaseNdk NO-SOURCE
    :GoogleMobileAdsPlugin:mergeReleaseJniLibFolders
    :GoogleMobileAdsPlugin:transformNativeLibsWithMergeJniLibsForRelease
    :GoogleMobileAdsPlugin:transformNativeLibsWithIntermediateJniLibsForRelease
    :GooglePlayGamesManifest.plugin:compileReleaseNdk NO-SOURCE
    :GooglePlayGamesManifest.plugin:mergeReleaseJniLibFolders
    :GooglePlayGamesManifest.plugin:transformNativeLibsWithMergeJniLibsForRelease
    :GooglePlayGamesManifest.plugin:processReleaseResources
    :GooglePlayGamesManifest.plugin:generateReleaseSources
    :GooglePlayGamesManifest.plugin:compileReleaseJavaWithJavac
    :GooglePlayGamesManifest.plugin:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
    :GooglePlayGamesManifest.plugin:transformNativeLibsWithIntermediateJniLibsForRelease
    :processReleaseJavaRes NO-SOURCE
    :validateSigningRelease
    :Firebase:mergeReleaseConsumerProguardFiles UP-TO-DATE
    :Firebase:transformNativeLibsWithSyncJniLibsForRelease
    :Firebase:mergeReleaseResources
    :Firebase:verifyReleaseResources
    :GoogleMobileAdsPlugin:mergeReleaseConsumerProguardFiles UP-TO-DATE
    :GoogleMobileAdsPlugin:transformNativeLibsWithSyncJniLibsForRelease
    :GoogleMobileAdsPlugin:mergeReleaseResources
    :GoogleMobileAdsPlugin:verifyReleaseResources
    :GooglePlayGamesManifest.plugin:extractReleaseAnnotations
    :GooglePlayGamesManifest.plugin:mergeReleaseConsumerProguardFiles UP-TO-DATE
    :GooglePlayGamesManifest.plugin:transformResourcesWithMergeJavaResForRelease
    :GooglePlayGamesManifest.plugin:transformClassesAndResourcesWithSyncLibJarsForRelease
    :GooglePlayGamesManifest.plugin:transformNativeLibsWithSyncJniLibsForRelease
    :GooglePlayGamesManifest.plugin:bundleRelease
    :GooglePlayGamesManifest.plugin:compileReleaseSources
    :GooglePlayGamesManifest.plugin:mergeReleaseResources
    :GooglePlayGamesManifest.plugin:verifyReleaseResources
    :GooglePlayGamesManifest.plugin:assembleRelease
    :Firebase:processReleaseResources
    :Firebase:generateReleaseSources
    :Firebase:compileReleaseJavaWithJavac
    :Firebase:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
    :Firebase:extractReleaseAnnotations
    :Firebase:transformResourcesWithMergeJavaResForRelease
    :Firebase:transformClassesAndResourcesWithSyncLibJarsForRelease
    :Firebase:bundleRelease
    :Firebase:compileReleaseSources
    :Firebase:assembleRelease
    :GoogleMobileAdsPlugin:processReleaseResources
    :processReleaseResources
    :generateReleaseSources
    :GoogleMobileAdsPlugin:generateReleaseSources
    :GoogleMobileAdsPlugin:compileReleaseJavaWithJavac
    :GoogleMobileAdsPlugin:transformClassesAndResourcesWithPrepareIntermediateJarsForRelease
    :javaPreCompileRelease
    :compileReleaseJavaWithJavac
    :compileReleaseSources
    :lintVitalRelease
    :transformClassesWithPreDexForRelease
    :transformDexWithDexForRelease FAILED
    99 actionable tasks: 81 executed, 18 up-to-date
    ]
    exit code: 1
     
  15. studentutu

    studentutu

    Joined:
    Oct 22, 2017
    Posts:
    38
    Also, I have managed to find a workaround - just disable in you unity Editor, Service tab - ads, and delete the unity ads package from a package manager. But now I have another issue - while waiting for a ready status for Unity Ad interstitial ad - I'm getting Could not load type 'UnityEngine.Analytics.AnalyticsEvent' from assembly 'Unity.Analytics.StandardEvents, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

    After this message,
    Monetization.IsReady("CustomInterstititalId");
    is always false....
    What can I do to fix it?
     
  16. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,914
    For this new issue that you are reporting, I would suggest that you post in the Ads forum
     
  17. studentutu

    studentutu

    Joined:
    Oct 22, 2017
    Posts:
    38
    Sure, could you give a link?
     
  18. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,914
    studentutu likes this.