universal-tools / UTNotificationsFeedback

7 stars 0 forks source link

Issue with Android Build in v1.7.3 #86

Open ghost opened 6 years ago

ghost commented 6 years ago

Hi,

We have just updated the UTNotifications from version 1.6.x to 1.7.3 in order to support Channel Notifications in Android. After updating the plugin, we are unable to make an Android build and getting this error:

`Assertion failed on expression: 'ms_Instance != NULL'

(Filename: /Users/builduser/buildslave/unity/build/Runtime/Network/PlayerCommunicator/ManagedProxy/GeneralConnectionManaged.cpp Line: 118)

unity-automation:{"messageType":"MemoryLeaks","allocatedMemory":164962643,"memoryLabels":[{"Default":2408},{"Permanent":16192},{"NewDelete":138428960},{"Thread":616},{"Manager":2392},{"VertexData":5604},{"Shader":2412},{"GfxDevice":75628},{"GfxThread":3632},{"Audio":5111808},{"Font":3359610},{"Physics":8},{"Serialization":12704},{"JobScheduler":144},{"GarbageCollector":1048576},{"BaseObject":1277920},{"Renderer":399584},{"Terrain":224},{"STL":164864},{"String":201352},{"DynamicArray":-5107424},{"Utility":-1040384},{"PoolAlloc":-224},{"ScriptManager":3280},{"Sprites":20961200},{"VR":11400},{"SceneManager":4576},{"EditorGui":12},{"EditorUtility":544},{"AssetImporter":1744},{"RestService":64},{"EditorGi":5481},{"License":984},{"UnityConnect":6024},{"Collab":728}]}

`

Things were just fine before the update. Only after the update, we are getting this error and the build fails. However, before this log comes, we also get the log: *** Completed 'Build.Player.AndroidPlayer' in 261 seconds (261016 ms)

We're totally blocked on this issue and not sure if this is due to UTNotifications update. Any help would be appreciated.

yuriy-universal-ivanov commented 6 years ago

Hi @myselfAB10 ,

Could you please provide any repro steps, as it's not something known to us. I've googled on it a little bit, f.e. https://github.com/Unity-Technologies/VolumetricLighting/issues/14 https://answers.unity.com/questions/1469095/running-unity-564-in-headless-throws-this-assert-a.html https://forum.unity.com/threads/build-fails-with-error-player-export-failed-reason-3-errors.473944/

But all I could get from it, that it happens to some people only in headless builds. Is it also the case for you? It wasn't related to UTNotifications for those people, but we could somehow cause the same sort behavior. Could you maybe create and send us to universal.tools.contact@gmail.com a sample Unity project which reproduces the issue, and the steps to reproduce it?

Thank you and sorry for any inconvenience.

ghost commented 5 years ago

Hi, Thanks for the update. Turns out the issue was due to some conflicting android support libraries that had to be manually removed. One more issue is being observed for iOS. In UTNotifications' IOSBuildPostProcessor.cs, we are getting an error.

The build actually succeeds with this: *** Completed 'Build.Player.iOSSupport' in 472 seconds (471636 ms)

However, there's an exception hitting at IOSBuildPostProcessor. BUILD-ERROR: BuildProcessor> BuildPlayer failed with Error: UTNotifications: Unable to automatically configure Xcode project's Push Notifications settings. Usually it is caused by using an out-of-date version of Xcode. Push Notifications, if enabled, may work or not, depending on a specific Xcode version. at System.Xml.XmlNode.CheckNodeInsertion (System.Xml.XmlNode newChild, System.Xml.XmlNode refChild) [0x00000] in <filename unknown>:0 at System.Xml.XmlNode.InsertBefore (System.Xml.XmlNode newChild, System.Xml.XmlNode refChild, Boolean checkNodeType, Boolean raiseEvent) [0x00000] in <filename unknown>:0 at System.Xml.XmlNode.InsertBefore (System.Xml.XmlNode newChild, System.Xml.XmlNode refChild) [0x00000] in <filename unknown>:0 at System.Xml.XmlNode.AppendChild (System.Xml.XmlNode newChild) [0x00000] in <filename unknown>:0

FYI, we use Xcode 9.1 and use headless builds

Apologies for commenting IOS bug in android title.

yuriy-universal-ivanov commented 5 years ago

Hi @myselfAB10 ,

It can be caused by using not the latest version of UTNotifications with Unity 2018.2: starting with that version Unity patches the Xcode project's push notifications capabilities itself, which caused conflicts with UTNotifications' patcher (so we disabled it in the latest update). If it's not the case, please let me know how it can be reproduced: Specific actions to be done, your exact version of Unity and macOS, project settings, whether it's reproduced or not in a normal (not headless) mode. And, of course, a sample repro Unity project would be the best.

ghost commented 5 years ago

Hi,

Thanks for the update.. I was able to resolve the issue. Seems like the root cause of the above issue was due to another issue.

Assets/UTNotifications/Src/iOS/IOSBuildPostprocessor.cs(7,7): error CS0246: The type or namespace nameUnityEditor' could not be found. Are you missing an assembly reference? Assets/UTNotifications/Src/iOS/IOSBuildPostprocessor.cs(9,7): error CS0246: The type or namespace name UnityEditor' could not be found. Are you missing an assembly reference?

This was coming. So I had compared the file IOSBuildPostProcessor.cs of this version(1.7.3) with the previous version(i.e. 1.6.3). I found that the macro at the starting of the file in 1.7.3 happened to be : #if UNITY_IOS while, the macro at the starting of the file in 1.6.3 happened to be: #if UNITY_EDITOR && UNITY_IOS

So, after adding the missing UNITY_EDITOR macro in the check, the builds are passing. Please let me know if we should go ahead with this fix. (As we don't want to change any of the library code as it can break anything.)

With reference to your above comment, we use Unity5.6.4p4 and macOS is 10.12.6

yuriy-universal-ivanov commented 5 years ago

Hi @myselfAB10 ,

Actually, due to a bug in latest versions of Unity 5.x, we had to remove that #if UNITY_EDITOR check and move IOSBuildPostprocessor.cs to a different folder: Assets/UTNotifications/Src/iOS/Editor/IOSBuildPostprocessor.cs. I see that in your case the file is for some reason still available at it's old location. Please:

  1. Make sure to update to the latest version of UTNotifications.
  2. If it doesn't help, manually move the file to Assets/UTNotifications/Src/iOS/Editor/.

The problem with #if UNITY_EDITOR is that latest versions of Unity 5 don't always define it when building the app, so the post processor can fail to work. Editor is a special folder name, which scripts are always compiled in Editor but not for runtime.

ghost commented 5 years ago

Hi @yuriy-universal-ivanov ,

Thank you again for the update. As I have stated above, we have migrated from UTNotifications 1.6.3 to 1.7.3 and not the current UTNotifications (1.7.4). I looked into the folder structure. The class IOSBuildPostProcessor.cs happens to be stored currently in: Assets/UTNotifications/Src/iOS/IOSBuildPostprocessor.cs And there is not sub-folder inside Assets/UTNotifications/Src/iOS/ named as Editor.

screen shot 2018-09-21 at 11 52 25 am

Attaching the screenshot for the folder structure of the same

Could you please clarify on this? FYI - we are not planning to upgrade to 1.7.4 immediately as we have just upgraded to 1.7.3

yuriy-universal-ivanov commented 5 years ago

@myselfAB10 ,

UTNotifications 1.7.4 is a Unity 2018.2-hotfix version for 1.7.3 and it even reports its version as 1.7.3. The location of IOSBuildPostprocessor.cs in 1.7.3 is the same: Assets/UTNotifications/Src/iOS/Editor/. It seems Unity failed to move it to the new location during the asset update process in your app (which happens with the Unity asset updater sometimes). So please either delete the whole UTNotifications folder and reimport the asset again, or just move the file to the designated location manually.