我在一个现有的Android Studio应用程序中使用一个带有Vuforia的Unity项目。一切正常,直到我必须进行一些调整。我将Unity(2019.3.06a)和Vuforia更新到了最新版本。现在,每次将Unity添加到MainActivity时,我的应用程序都会崩溃。 Unity SDK已更新,现在我找不到任何解决方案。以下是将UnityPlayer添加到我的活动中的代码。它在行上崩溃(“ mUnityPlayer = UnityPlayer(this @ MainActivity)”)。为了使其更容易一点,您可以在以下链接中找到UnityPlayer类:https://pastebin.com/Pez3J6mp。
private fun bindingUiStuff() {
val adapter =
MainPagerAdapter(this@MainActivity, supportFragmentManager, leftFragment, mainFragment, rightFragment)
vpPager.adapter = adapter
vpPager.currentItem = PAGE_MIDDLE
vpPager.addOnPageChangeListener(topMotionLayout)
setIntroLayout()
mUnityPlayer = UnityPlayer(this@MainActivity)
mUnityPlayer.requestFocus()
fl_forUnity.addView(
mUnityPlayer.view,
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT
)
mUnityPlayer.setOnTouchListener { _, _ ->
return@setOnTouchListener false
}
val currentUser = auth.currentUser
Log.v("currentUser", currentUser.toString())
}
Anny解决方案?