Search Unity

Android app_build is blank

Discussion in 'Unity Cloud Diagnostics' started by tiotictoc, Jan 31, 2020.

  1. tiotictoc

    tiotictoc

    Joined:
    Mar 6, 2019
    Posts:
    1
    Whenever we receive a crash report on Android, the app_build metadata are all blank. This does not happen on iOS builds at all.

    I have exactly the same issue as this person: https://forum.unity.com/threads/app-build-is-0-for-all-build-made-with-ucb.757796/

    However, I have a pre-export script hooked up that updates the PlayerSettings.Android.bundleVersionCode value to the build number passed by unity cloud. This value is reported correctly on google play and in-game except for the crash reports.
     
  2. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @tiotictoc, we have an Issue Tracker link for the bug you're describing that you can visit here. This bug is high on our backlog and we will be investigating as soon as we can. Thank you for reporting your experiences with the bug and we'll update here when we have more information.
     
  3. SampsaPlaysome

    SampsaPlaysome

    Joined:
    Oct 20, 2019
    Posts:
    34
    Has this been fixed already? At least in 2019.3.7f1 it's still happening.
     
  4. SampsaPlaysome

    SampsaPlaysome

    Joined:
    Oct 20, 2019
    Posts:
    34
    We're using this piece of code to get the version code in Android builds and supplying it to Unity Crash Reporter.

    Code (CSharp):
    1. try
    2.             {
    3.                 AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
    4.  
    5.                 var ca = up.GetStatic<AndroidJavaObject>("currentActivity");
    6.  
    7.                 AndroidJavaObject packageManager = ca.Call<AndroidJavaObject>("getPackageManager");
    8.  
    9.                 var pInfo = packageManager.Call<AndroidJavaObject>("getPackageInfo", Application.identifier, 0);
    10.  
    11.                 int versionCode = pInfo.Get<int>("versionCode");
    12.                 Debug.Log("versionCode:" + versionCode);
    13.                 CrashReportHandler.SetUserMetadata("android_version_code", versionCode.ToString());
    14.             }
    15.             catch (Exception e)
    16.             {
    17.                 Debug.LogWarning("Getting android versionCode failed: " + e.Message);
    18.             }
    Reason we need this is that our version code is automatically handled by the Gradle Play Publisher plugin (https://github.com/Triple-T/gradle-play-publisher)