CymaticLabs / Unity3D.Amqp

AMQP client library for Unity 3D supporting RabbitMQ
MIT License
97 stars 21 forks source link

Deploying on Android target #17

Open mandar1998 opened 4 years ago

mandar1998 commented 4 years ago

Hi, I am working on an AR project in Unity which takes data from the Rabbit AMQP server. On the PC (macOS) I can receive messages perfectly fine. However, as I deploy it on an Android device it throws me the error given below:

RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable -->System.TypeLoadException: Could not find method due to a type load error
at RabbitMQ.Client.Framing.Impl.Model..ctor (RabbitMQ.Client.Impl.ISession session) [0x00000] in <17f048ced61b47c38ce84c39b5c3f15d>:0
at RabbitMQ.Client.Framing.Impl.ProtocolBase.CreateModel (RabbitMQ.Client.Impl.ISession session) [0x00000] in <17f048ced61b47c38ce84c39b5c3f15d>:0
at RabbitMQ.Client.Framing.Impl.Connection..ctor (RabbitMQ.Client.IConnectionFactory factory, System.Boolean insist, RabbitMQ.Client.Impl.IFrameHandler frameHandler) [0x000b1] in <17f048ced61b47c38ce84c39b5c3f15d>:0
at RabbitMQ.Client.Framing.Impl.ProtocolBase.CreateConnection (RabbitMQ.Client.IConnectionFactory factory, System.Boolean insist, RabbitMQ.Client.Impl.IFrameHandler frameHandler) [0x00000] in <17f048ced61b47c38ce84c39b5c3f15d>:0
at RabbitMQ.Client.ConnectionFactory.CreateConnection () [0x0002a] in <17f048ced61b47c38ce84c39b5c3f15d>:0
Rethrow as BrokerUnreachableException: None of the specified endpoints were reachable -->System.TypeLoadException: Could not find method due to a type load error

Specifications

Any urgent help would be appreciated! Thank you

ghost commented 3 years ago

I had the same error and for me, changing API Compatibility Level in Player -> Other Settings to .NET 4.x solves the issue.

moncio commented 3 years ago

Hi, I'm having the same troubles and the problem persists.

I installed RabbitMQ by docker typing the next comand: docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management

Then, running the scene "AmqpDemo", when I run inside the Unity player clicking the "connect" button it's ok but when I run for Android target, the terminal shows me the next issue:

2021-07-27 14:53:40.560 8867-10080/com.DefaultCompany.OpenPoseRig I/Unity: RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable ---> RabbitMQ.Client.Exceptions.ConnectFailureException: Connection failed ---> System.Net.Sockets.SocketException: mono-io-layer-error (111) at System.Net.Sockets.SocketAsyncResult.CheckIfThrowDelayedException () [0x00000] in <00000000000000000000000000000000>:0 at System.Net.Sockets.TcpClient.EndConnect (System.IAsyncResult asyncResult) [0x00000] in <00000000000000000000000000000000>:0 at RabbitMQ.Client.Impl.SocketFrameHandler.Connect (System.Net.Sockets.TcpClient socket, RabbitMQ.Client.AmqpTcpEndpoint endpoint, System.Int32 timeout) [0x00000] in <00000000000000000000000000000000>:0 at RabbitMQ.Client.Impl.SocketFrameHandler..ctor (RabbitMQ.Client.AmqpTcpEndpoint endpoint, RabbitMQ.Client.ConnectionFactoryBase+ObtainSocket socketFactory, System.Int32 timeout) [0x00000] in <00000000000000000000000000000000>:0 at RabbitMQ.Client.Framing.Impl.ProtocolBase.CreateFrameHandler (RabbitMQ.Client.Am

These are some of my current players settings for Android deployment:

image

Anyone can help me? @meverett

Thank you!

_

mandar1998 commented 3 years ago

System.Net.Sockets.SocketException: mono-io-layer-error (111) This line says that it's some HTTP connection issue. Maybe check if you are calling the correct URL path, if you are calling at all.

moncio commented 3 years ago

Thank you for your reply @mandar1998 , but the current error shows me is the following: None of the specified endpoints were reachable ---> System.PlatformNotSupportedException: Operation is not supported on this platform.

moncio commented 3 years ago

@mandar1998 @meverett @CymaticLabs look at this, when I run with API level .NET 4.x and scripting backend Mono, everything is ok but when I change the scripting backend to IL2CPP, I have the next problem:

image

My question is, no posibility to run the demo for the last scripting backend? Thanks!

moncio commented 3 years ago

Well, after several tests, looking for different solutions, I realised in this issue is the key: https://github.com/CymaticLabs/Unity3D.Amqp/issues/13#issuecomment-562061616

Downloading those dll and replacing in the proper folder, everyting is working for both architectures. Anyway,thanks to all of you for the help.