报错内容如下:java.lang.IllegalArgumentException:android:Targeting S+ (version32 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
原因是安卓12以是对PendingIntent有新的要求, 但是MQTT库"org.eclipse.pahorg.eclipse.paho.android.service:1.1.1"停留在了1.1.1不符合SDK32上关于PendingIntent的要求,似乎也不打算发布新的版本。
解决办法:在github上有人提供了service1.1.1解决这人问题的源码,自己编译生成新的jar包并依赖它就好了。
相关网址:https://github.com/eclipse/paho.mqtt.android/issues/485