JiangJuHong / FlutterTencentImPlugin

腾讯即时通讯(IM),Flutter插件
Apache License 2.0
214 stars 56 forks source link

android release包闪退 #145

Closed mrcwl closed 3 years ago

mrcwl commented 3 years ago

插件版本tencent_im_plugin: ^1.2.13

debug包正常

2021-03-30 14:44:38.393 19867-19867/? E/AndroidRuntime: at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:126) at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(SourceFile:1) at com.alibaba.fastjson.serializer.FieldSerializer.writeValue(SourceFile:74)

JiangJuHong commented 3 years ago

请确保你项目的其他插件/环境 的混淆成功配置。 除非提供更明显的错误信息,否则将无法排查。

mrcwl commented 3 years ago

请确保你项目的其他插件/环境 的混淆成功配置。 除非提供更明显的错误信息,否则将无法排查。

Flutter Wrapper

-keep class io.flutter.app. { *; } -keep class io.flutter.plugin.* { ; } -keep class io.flutter.util. { *; } -keep class io.flutter.view. { *; } -keep class io.flutter.* { ; } -keep class io.flutter.plugins. { *; }

-keep class io.agora.*{;}

-dontoptimize -dontpreverify -keepattributes EnclosingMethod,Signature -dontwarn cn.jpush. -keep class cn.jpush. { *; }

-dontwarn cn.jiguang. -keep class cn.jiguang. { *; }

-dontwarn cn.jmessage. -keep class cn.jmessage.{ *; }

-keepclassmembers class * { public void onEvent(**); }

========================gson================================

-dontwarn com.google. -keep class com.google.gson. {*;}

========================protobuf================================

-keep class com.google.protobuf.* {;}

=======================talkingdata=============================

-dontwarn com.tendcloud.tenddata. -keep class com.tendcloud. {*;} -keep public class com.tendcloud.tenddata. { public protected *;} -keepclassmembers class com.tendcloud.tenddata.{ public void (); } -keep class com.talkingdata.sdk.TalkingDataSDK {public *;} -keep class com.apptalkingdata. {*;}

-keep public class extends android.app.Service -keep public class extends android.content.BroadcastReceiver -keep class com.tencent.android.tpush. {*;} -keep class com.tencent.tpns.baseapi.* {;} -keep class com.tencent.tpns.mqttchannel. {*;} -keep class com.tencent.tpns.dataacquisition.* {;}

小米推送

-keep class com.xiaomi.*{;} -keep public class * extends com.xiaomi.mipush.sdk.PushMessageReceiver

华为推送

-ignorewarnings -keepattributes Annotation -keepattributes Exceptions -keepattributes InnerClasses -keepattributes Signature -keepattributes SourceFile,LineNumberTable -keep class com.hianalytics.android.{*;} -keep class com.huawei.updatesdk.*{;} -keep class com.huawei.hms.{*;}

这是我目前项目中的混淆配置,这个日志会刷很长无法追踪具体的位置

JiangJuHong commented 3 years ago

你可尝试在demo中进行打包,这有助于排查

mrcwl commented 3 years ago

你可尝试在demo中进行打包,这有助于排查

image 日志感觉是扩展消息的class混淆出现问题或者该class 没有实现serialization接口。 禁用项目混淆后没有闪退

JiangJuHong commented 3 years ago

尝试加上以下配置:

# 腾讯云IM
-keep class com.tencent.** { *; }

# FastJson
-dontwarn com.alibaba.fastjson.**
-keep class com.alibaba.fastjson.**{*;}

# 泛型
-keepattributes Signature

# 不混淆Serializable接口的子类
-keepclassmembers class * implements java.io.Serializable { *; }

# 忽略实体类
-keep class top.huic.tencent_im_plugin.** {*;}
JiangJuHong commented 3 years ago

这个问题太久没进行更新,此问题将被关闭。在需要时可以重新打开。

lostcixin commented 3 years ago

你可尝试在demo中进行打包,这有助于排查

image 日志感觉是扩展消息的class混淆出现问题或者该class 没有实现serialization接口。 禁用项目混淆后没有闪退

你解决了吗

mrcwl commented 3 years ago

你可尝试在demo中进行打包,这有助于排查

image 日志感觉是扩展消息的class混淆出现问题或者该class 没有实现serialization接口。 禁用项目混淆后没有闪退

你解决了吗

就是混淆的问题,加上上面的混淆可以解决