hivemq / hivemq-mqtt-client

HiveMQ MQTT Client is an MQTT 5.0 and MQTT 3.1.1 compatible and feature-rich high-performance Java client library with different API flavours and backpressure support
https://hivemq.github.io/hivemq-mqtt-client/
Apache License 2.0
832 stars 153 forks source link

No implementation found for int io.netty.channel.epoll.Native.offsetofEpollData() #562

Closed GGengg closed 1 year ago

GGengg commented 1 year ago

I have wrote this simple function to test MQTT in my Android app. Whenever this method is called the app crashes. And the error message is No implementation found for int io.netty.channel.epoll.Native.offsetofEpollData() (tried Java_io_netty_channel_epoll_Native_offsetofEpollData and Java_io_netty_channel_epoll_Native_offsetofEpollData__).

public String connect(){
            try{
                Mqtt5Client client = Mqtt5Client.builder()
                        .identifier("Pixel5")
                        .serverHost("broker.hivemq.com")
                        .serverPort(1883)
                        .build();
                Mqtt5ConnAck connAckMessage = client.toBlocking().connect();
                Log.d(TAG, connAckMessage.getReasonCode().toString());
                return connAckMessage.getReasonCode().toString();
            } catch (Exception e) {
                Log.d(TAG, "Connection failed");
                return e.getMessage();
            }
        }

I am using "com.hivemq:hivemq-mqtt-client:1.3.0" and Android Studio Dolphin | 2021.3.1 Patch 1. I am currently testing it on Google Pixel 5 with Windows operating system. I am trying to connection to the public broker "broker.hivemq.com" with port 1883.

pglombardo commented 1 year ago

Hi @GGengg - have you made any progress on this?

Did you follow the related documentation? https://hivemq.github.io/hivemq-mqtt-client/docs/installation/android/

There was another report of this (with fix) here: https://stackoverflow.com/questions/56677615/how-to-connect-to-mqtt3asyncclient-using-hivemq-mqtt-library

Let me know if these help. The fix may simply be adding <uses-permission android:name="android.permission.INTERNET"/> to your manifest.

GGengg commented 1 year ago

@pglombardo Yes I have followed the link provided and it didn't solve my problem back then.

Funny enough I took a week off and when I came back everything is working fine. I guess it was probably a sync issue (all my files are on OneDrive cloud) or something and I wont bother myself with it. This question seems silly now and I will close it.

Thanks again for trying to help.