Apr
5
2018

Upgrading old 5.5 project to 2017.4 LTS

So had to upgrade one old Android+iOS cardboard app into newer unity version..
(Due to old unity doesn’t support latest apple os updates [link], missing new app store image sizes [link], some plugins are getting fixes/updates to newer versions, Android google play has new requirements coming up [link],  and would be nice to use new unity videoplayer etc..)

 

Project has multiple external plugins from asset store (including EasyMovieTexture, YoutubePlayer/API, MoonSharp, ToonShaders, UberLogger, LeanTween, Old GVR 0.7 ..), and many custom shaders.

Surprisingly auto-upgrade went cleanly, and iOS build works fine.. BUT, android build crashes on start, with the error below:


// caused by old GVR 0.7
FATAL EXCEPTION: main
java.lang.Error: FATAL EXCEPTION [main]
E/AndroidRuntime(10577): Caused by: java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/ContextWrapper;)V in class Lcom/unity3d/player/UnityPlayer; or its super classes (declaration of 'com.unity3d.player.UnityPlayer' appears in /data/app/com.xyz.asdas-2/base.apk)
E/AndroidRuntime(10577): at com.google.unity.GoogleUnityActivity.onCreate(GoogleUnityActivity.java:114)
E/AndroidRuntime(10577): at android.app.Activity.performCreate(Activity.java:6289)
E/AndroidRuntime(10577): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
E/AndroidRuntime(10577): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2655)
E/AndroidRuntime(10577): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2767)
E/AndroidRuntime(10577): at android.app.ActivityThread.access$900(ActivityThread.java:177)
E/AndroidRuntime(10577): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1449)
E/AndroidRuntime(10577): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(10577): at android.os.Looper.loop(Looper.java:145)
E/AndroidRuntime(10577): at android.app.ActivityThread.main(ActivityThread.java:5951)
E/AndroidRuntime(10577): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(10577): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(10577): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
E/AndroidRuntime(10577): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)


Error below, caused by either
– androidmanifest.xml, too small min/target sdk, set both to 21 for 2017.4
– or phone had denied installing (you pressed deny, instead of allow), go to Settings/DeveloperSettings/Permissions/Install via usb, should have blocked your app, disable and try again
// warning
Plugins/Android/AndroidManifest.xml has android:targetSdkVersion set to 21 but "Target API Level" in Editor is set to 26! Setting android:targetSdkVersion to 26.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
// error
CommandInvokationFailure: Unable to install APK to device. Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details.
…/android-sdk\platform-tools\adb.exe -s "28a358290404" install -r "…\asdf.apk"
stderr[
Failed to install asdf.apk: Failure [INSTALL_CANCELED_BY_USER]
]
stdout[
]
exit code: 1
at UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0
at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00000] in <filename unknown>:0

 

For the script updates, only manual work was to rename these couple changed method/names:

Application.bundleIdentifier > Application.identifier
Caching.CleanCache() > Caching.ClearCache()
animator.Stop() > animator.enabled = false;

 

These things updated automagically:

mul(UNITY_MATRIX_MVP, pos) > UnityObjectToClipPos(pos)
packedNativeUnityEngineObject.classId > packedNativeUnityEngineObject.nativeTypeArrayIndex
packedNativeType.baseClassId > packedNativeType.nativeBaseTypeArrayIndex
EventType.mouseDown > EventType.MouseDown
EventType.mouseUp > EventType.MouseUp
EventType.mouseDrag > EventType.MouseDrag
EventType.scrollWheel > EventType.ScrollWheel
www.isError > www.isNetworkError
VRSettings.enabled > UnityEngine.XR.XRSettings.enabled
lineRenderer.numPositions > lineRenderer.positionCount
UnityWebRequest.GetTexture > UnityWebRequestTexture.GetTexture
VRNode m_VRNode = VRNode.Head > UnityEngine.XR.XRNode m_VRNode = UnityEngine.XR.XRNode.Head
InputTracking.GetLocalRotation > UnityEngine.XR.InputTracking.GetLocalRotation

One thing i noticed, the old undocumented findChild() seems to be removed.. which might be slower now(?) if it searches whole scene then:

go.FindChild("name") > go.Find("name")

 

Other notes:
– Main app icon in Player Settings seems to be empty, had to assign that back
– Api compatibility setting had changed from 2.0, back into 2.0 subset, which caused build errors with one plugin, had to assign it back to full 2.0:
“ArgumentException: The Assembly System.Web is referenced by YoutubeUnity (‘Assets/Youtube/YoutubePlayer/Plugins/YoutubeUnity.dll’). But the dll is not allowed to be included or could not be found.”
– APK Build size went up from 75mb > 89mb
– iOS build works fine, Android build crashes on start (see error log above) *currently not yet solved, probably will try updating GVR later.. [forum link]

 

Final Results:

– Reverted back and updated to 5.6.5p3 instead.. old gvr still works with that.


Leave a comment

Connect

Twitter View LinkedIn profile Youtube Youtube Join Discord Twitch Instagram

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.