As of version 2023.1.0a17 UnityPlayer doesn't extend FrameLayout. Instead, it provides getFrameLayout() API.
After introducing GameActivity for Android in 2023.1.0a20, Unity project exported using GameActivity entry point fails with the error below:
C:\Projects\uaal-example-master\UnityProject\androidBuild\unityLibrary\src\main\java\com\company\product\OverrideUnityActivity.java:5: error: cannot find symbol
import com.unity3d.player.UnityPlayerActivity;
^
symbol: class UnityPlayerActivity
location: package com.unity3d.player
\
\
Solution:
Use mUnityPlayer.getFrameLayout() instead of mUnityPlayer. And, to make the project work for both UnityPlayerActivity and UnityPlayerGameActivity, updated Unity source code(#32061)
Now we have three options when you export the example to an Android Project like below.
( Go to Player Settings window -> In Other Settings -> Configuration section -> select Activity or GameActivity, or both as Application Entry Point)
Export the project with both Activity and GameActivity options selected.
\
After exporting the project with only Activity option checked, users must delete the MainUnityGameActivity from the NativeAndroidApp project.
\
After exporting the project with only GameActivity option checked, users must delete the MainUnityActivity from the NativeAndroidApp project.
Purpose of this PR
Jira link: https://jira.unity3d.com/browse/UUM-20370 Trunk PR: #32061
\ The issue:
Before introducing GameActivity for Android in 2023.1, the way you get FrameLayout was updated first.
In 2022.2, UnityPlayer extends FrameLayout.
As of version 2023.1.0a17 UnityPlayer doesn't extend FrameLayout. Instead, it provides getFrameLayout() API.
After introducing GameActivity for Android in 2023.1.0a20, Unity project exported using GameActivity entry point fails with the error below:
\ \ Solution: Use mUnityPlayer.getFrameLayout() instead of mUnityPlayer. And, to make the project work for both UnityPlayerActivity and UnityPlayerGameActivity, updated Unity source code(#32061)
Now we have three options when you export the example to an Android Project like below. ( Go to Player Settings window -> In Other Settings -> Configuration section -> select Activity or GameActivity, or both as Application Entry Point)
\
\