Open nuno-silva opened 4 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.
I agree
Agree :) it was very useful
I agree
I agree
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.
非常赞成,现在有新的解决方案了吗
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:
android.enableJetifier=true
ingradle.properties
(https://github.com/eclipse/paho.mqtt.android/issues/321#issuecomment-531628464), which doesn't seem to work anymoreimplementation 'androidx.legacy:legacy-support-v4:1.0.0'
tobuild.grade
(https://github.com/eclipse/paho.mqtt.android/issues/321#issuecomment-533602703)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 toandroidx.localbroadcastmanager.content.LocalBroadcastManager
.