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

Field currentActivity or type signature not found Error in Player Unity 2020.1

Discussion in 'Scripting' started by mrjaimez, Aug 11, 2020.

  1. mrjaimez

    mrjaimez

    Joined:
    Aug 11, 2020
    Posts:
    1
    Hi All!
    I'm facing the error: Exception: Field currentActivity or type signature not found When i try to play the Start Scene on Player.
    Platform Android
    The only object is a Button that calls Signin with Google.
    There are no errors on compilation, but when try to run the test on player shows the described error.

    As per i saw on others posts, there is no way to play the APP on the player. Is this true? have to deploy and tes on a devica each change that i make to the app?

    Hope you can helpme!!!
     
  2. Powerpbk

    Powerpbk

    Joined:
    Jul 1, 2020
    Posts:
    1
    I have the same problem.Have you found the reason?
     
  3. BeorGames

    BeorGames

    Joined:
    Jul 28, 2018
    Posts:
    61
    Hi, I'm facing the same issue, but my app doesn't work at all, it freezes and crashes when I open it. I kind of understood it has something to do with
    UnityEngine.AndroidJNIModule and
    AndroidJavaObject but I've no idea how to solve it, it's driving me mad. I'm trying to use Google Package Asset Delivery, but when it starts loading the package it calls this helper function
    Code (CSharp):
    1. public static class UnityPlayerHelper
    2.     {
    3.         /// <summary>
    4.         /// Gets the current activity running in Unity. This object should be disposed after use.
    5.         /// </summary>
    6.         /// <returns>A wrapped activity object. The AndroidJavaObject should be disposed.</returns>
    7.         public static AndroidJavaObject GetCurrentActivity()
    8.         {
    9.             using (var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
    10.             {
    11.                 return unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
    12.             }
    13.         }
    14.     }
    And I get this huge error:
    Exception: Field currentActivity or type signature not found
    UnityEngine._AndroidJNIHelper.GetFieldID (System.IntPtr jclass, System.String fieldName, System.String signature, System.Boolean isStatic) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    UnityEngine.AndroidJNIHelper.GetFieldID (System.IntPtr javaClass, System.String fieldName, System.String signature, System.Boolean isStatic) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    UnityEngine._AndroidJNIHelper.GetFieldID[ReturnType] (System.IntPtr jclass, System.String fieldName, System.Boolean isStatic) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    UnityEngine.AndroidJNIHelper.GetFieldID[FieldType] (System.IntPtr jclass, System.String fieldName, System.Boolean isStatic) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    UnityEngine.AndroidJavaObject._GetStatic[FieldType] (System.String fieldName) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    UnityEngine.AndroidJavaObject.GetStatic[FieldType] (System.String fieldName) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    Google.Play.Common.UnityPlayerHelper.GetCurrentActivity () (at Assets/GooglePlayPlugins/com.google.play.common/Runtime/Scripts/UnityPlayerHelper.cs:32)
    Google.Play.AssetDelivery.Internal.AssetPackManager..ctor () (at Assets/GooglePlayPlugins/com.google.play.assetdelivery/Runtime/Scripts/Internal/AssetPackManager.cs:33)
    Google.Play.AssetDelivery.Internal.PlayAssetDeliveryInternal..ctor () (at Assets/GooglePlayPlugins/com.google.play.assetdelivery/Runtime/Scripts/Internal/PlayAssetDeliveryInternal.cs:44)
    Google.Play.AssetDelivery.PlayAssetDelivery.get_Instance () (at Assets/GooglePlayPlugins/com.google.play.assetdelivery/Runtime/Scripts/PlayAssetDelivery.cs:32)
    Google.Play.AssetDelivery.PlayAssetDelivery.RetrieveAssetBundleAsync (System.String assetBundleName) (at Assets/GooglePlayPlugins/com.google.play.assetdelivery/Runtime/Scripts/PlayAssetDelivery.cs:57)
     
  4. heiwa-games

    heiwa-games

    Joined:
    Apr 8, 2018
    Posts:
    8
  5. NRebel

    NRebel

    Joined:
    Sep 13, 2019
    Posts:
    2
    Hi All, I'm getting the same error. Has anyone found a solution?
     
  6. unity_6H9mo6XthbhibA

    unity_6H9mo6XthbhibA

    Joined:
    Nov 18, 2020
    Posts:
    2
    The same error guys, HELP
     
  7. rafayhamid7

    rafayhamid7

    Joined:
    Oct 11, 2018
    Posts:
    1
    I get this error while integrating fb ads. Help
     
  8. Whatevers2011

    Whatevers2011

    Joined:
    Jul 12, 2020
    Posts:
    3
    I solved this by reverting changes I had done the day before. I had commented out code to do with initialising google play and it resulted in this error when trying to call in app review.
     
  9. upendraakki329

    upendraakki329

    Joined:
    Sep 21, 2020
    Posts:
    6
    Does anyone got any solution to this i am also getting the same error
     
  10. shawonRokerz

    shawonRokerz

    Joined:
    Jan 10, 2021
    Posts:
    3
    Same error while using the following asset Contact List !!! Any Idea Guys????
     
  11. KaneKennste

    KaneKennste

    Joined:
    Oct 1, 2019
    Posts:
    7
    Hi,
    i had the same issue. Probably most of you could figure out that the AppUpdateManager is causing this error. For me this meant that building android apk was possible, but "build and run" wasn't.
    I used to initialize the AppUpdateManager as member variable like this:
    Code (CSharp):
    1. private AppUpdateManager appUpdateManager = new AppUpdateManager();
    I fixed it by moving it into Awake() and checking for the platform, like this:
    Code (CSharp):
    1. private void Awake()
    2. {
    3.     if (Application.platform == RuntimePlatform.Android)
    4.     {
    5.         this.appUpdateManager = new AppUpdateManager();
    6.     }
    7. }
    Of course, the remaining code that is relying on the AppUpdateManager, also only runs when the platform is Android.

    I hope this will help some of you.
     
    mfatihbarut likes this.
  12. vickychaudhary8955

    vickychaudhary8955

    Joined:
    May 11, 2021
    Posts:
    1
    me tooo brother have you founded the solution of how to resolve it??
     
  13. moneysolutionsxyz

    moneysolutionsxyz

    Joined:
    Jul 17, 2022
    Posts:
    14
    Me too
     
  14. pmitsolution

    pmitsolution

    Joined:
    Aug 17, 2022
    Posts:
    4
    hey bro did you get the solution ????
     
    alecfilios likes this.
  15. pmitsolution

    pmitsolution

    Joined:
    Aug 17, 2022
    Posts:
    4
    if you get the solution ,please post here
     
    alecfilios likes this.
  16. pmitsolution

    pmitsolution

    Joined:
    Aug 17, 2022
    Posts:
    4
    hey ,did you get the solution ??
     
  17. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,533
    This is nothing to do with 2D at all. Moving it to scripting.
     
  18. pmitsolution

    pmitsolution

    Joined:
    Aug 17, 2022
    Posts:
    4
    @MelvMay
    I did not get exact reason for this error . can you help liitle bit
     
  19. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,533
    I'm on the 2D team so unfortunately not. This is why I moved this thread to scripting as it has a higher chance of someone knowing unlike it being on an inappropriate forum. Sorry.
     
  20. Abhoopendra

    Abhoopendra

    Joined:
    Aug 14, 2022
    Posts:
    2
    @MelvMay
    I tried all solution which are available on internet:( . but I did not get any logistic wayo_Oo_O
    Any approach sir @MelvMay

    error is like :
    Exception: Field currentActivity or type signature not found
    UnityEngine._AndroidJNIHelper.GetFieldID (System.IntPtr jclass, System.String fieldName, System.String signature, System.Boolean isStatic) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    UnityEngine.AndroidJNIHelper.GetFieldID (System.IntPtr javaClass, System.String fieldName, System.String signature, System.Boolean isStatic) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    UnityEngine._AndroidJNIHelper.GetFieldID[ReturnType] (System.IntPtr jclass, System.String fieldName, System.Boolean isStatic) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    UnityEngine.AndroidJNIHelper.GetFieldID[FieldType] (System.IntPtr jclass, System.String fieldName, System.Boolean isStatic) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    UnityEngine.AndroidJavaObject._GetStatic[FieldType] (System.String fieldName) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    UnityEngine.AndroidJavaObject.GetStatic[FieldType] (System.String fieldName) (at <1b8d7d6285464cff8aa5ccc91decf4f7>:0)
    Google.Play.Common.UnityPlayerHelper.GetCurrentActivity ()
     
  21. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,533
    So you didn't read what I said above I guess. TLDR? ;)
     
  22. Abhoopendra

    Abhoopendra

    Joined:
    Aug 14, 2022
    Posts:
    2
    yes , i read more than 10 times ,but i didn't get your statement " I moved this thread to scripting"
    and why ? you can have from experts who knows. my request is only for reason behind this error and solution .
    i am trying to solve this error from last 10 days and i repeat all steps carefully more than 15 time but i don't know what i am missing. help please :(
     
  23. moneysolutionsxyz

    moneysolutionsxyz

    Joined:
    Jul 17, 2022
    Posts:
    14
    Not yet!
     
  24. redaaitlaarab

    redaaitlaarab

    Joined:
    Dec 22, 2020
    Posts:
    1
  25. RedForceFT

    RedForceFT

    Joined:
    Aug 5, 2019
    Posts:
    19
    solutions?
     
  26. NayLinHtun

    NayLinHtun

    Joined:
    Sep 30, 2019
    Posts:
    3
    solution??
     
  27. VoidX_HUN

    VoidX_HUN

    Joined:
    Apr 20, 2015
    Posts:
    5
    After pulling out my hair, I found the solution. This is Unity's way of telling you you have to run this from the main thread.
     
  28. Ctapik

    Ctapik

    Joined:
    Mar 10, 2023
    Posts:
    1
    what this mean
     
  29. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,639
    Bunny83 likes this.
  30. Razeen_AG

    Razeen_AG

    Joined:
    Aug 5, 2019
    Posts:
    3
    Did you find any solutions yet??
    I have tried multiple things but I still can't find the solution
     
  31. VoidX_HUN

    VoidX_HUN

    Joined:
    Apr 20, 2015
    Posts:
    5
    You have to call it from OnUpdate/OnLateUpdate/etc. For example, calling from OnAudioFilterRead/timers/tasks will cause this issue, because they are different threads.