Unity3D:找不到字段currentActivity或类型签名 [英] Unity3D: Field currentActivity or type signature not found

查看:2460
本文介绍了Unity3D:找不到字段currentActivity或类型签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将我的统一版本升级到2019.2.17后,出现此错误:

after upgrading my unity version to 2019.2.17 i get this error:

异常:找不到字段currentActivity或类型签名 UnityEngine._AndroidJNIHelper.GetFieldID(System.IntPtr jclass, System.String fieldName,System.String签名,System.Boolean isStatic)

Exception: Field currentActivity or type signature not found UnityEngine._AndroidJNIHelper.GetFieldID (System.IntPtr jclass, System.String fieldName, System.String signature, System.Boolean isStatic)

当尝试使用以下代码获取currentActivity时:

when trying to get currentActivity with this code:

    // Retrieve the UnityPlayer class.
    unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");

    // Retrieve the UnityPlayerActivity object ( a.k.a. the current context )
    unityActivity = unityPlayerClass.GetStatic<AndroidJavaObject>("currentActivity");

我该如何解决该问题?

推荐答案

您需要在Unity Hub中安装适用于2019.2.17的Android模块,每次更改版本时,都需要为该版本安装Android.

You need to install the Android module for 2019.2.17 in Unity Hub, every time you change version you need to install Android for that version.

这篇关于Unity3D:找不到字段currentActivity或类型签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆