eclipse / paho.mqtt.android

MQTT Android
Other
2.89k stars 865 forks source link

Replace deprecated support.v4 classes with androidx #420

Open nuno-silva opened 4 years ago

nuno-silva commented 4 years ago

The LocalBroadcastManager is part of the Android support library, which is no longer maintained.

Therefore, android.support.v4.content.LocalBroadcastManager class used by https://github.com/eclipse/paho.mqtt.android/blob/3cb8af72f21b56ba72a6a6ddf3066d07d42f80b5/org.eclipse.paho.android.service/src/main/java/org/eclipse/paho/android/service/MqttAndroidClient.java#L58 is deprecated.

This has caused many issues already (e.g. #378 and #321) because it is not automatically linked in anymore. The workarounds I've seen are:

However, these workarounds do not fix the core issue and encourage people to use deprecated/unmaintained libraries. Instead, this class (and any other belonging to the support v4 lib) should be replaced by an equivalent class from AndroidX libraries.

There's a migration guide available.

android.support.v4.content.LocalBroadcastManager maps to androidx.localbroadcastmanager.content.LocalBroadcastManager.

msdn65 commented 3 years ago

I feel I must empahasize this request! Building a new app from scratch and having to include umaintained libraries for it to work leaves me a bit insecure of how to cope with this in my project.

cyixlq commented 3 years ago

I agree

RogelioRosas commented 3 years ago

Agree :) it was very useful

chenzhaohe commented 3 years ago

I agree

ZRainH commented 2 years ago

I agree

jschleppy commented 2 years ago

This is pretty old, so not expecting this to get fixed, but while I too agree, I have working results when including "android.enableJetifier=true" setting and wanted to chime in for anyone else who happens to look here in same boat as me. I'm not sure exactly what's different between my project and OP's (and others from looks of mixed results in linked issue), but I do tend to keep all other libs and plugins up-to-date. That said, if that jetifier setting isn't working for you, look into outdated components to your project, starting with the com.android.tools.build:gradle version you're using.

1970578978 commented 1 month ago

非常赞成,现在有新的解决方案了吗