android分享图片问题
android版本:9或者10
微信sdk版本:implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.6.5'
问题描述:能够拉起分享,预览的图片效果也是对的,选择联系人,点击发送也提示成功,但是实际上什么都没有发出去
问题关键代码:
WXImageObject tmp = new WXImageObject();
tmp.imagePath = path;
改成如下就能正常发送出去:
Bitmap bmp = BitmapFactory.decodeFile(path);
WXImageObject tmp = new WXImageObject(bmp);
上述代码中,path里的值是完全一样的,至少能说明path是没有问题的,格式为:/data/user/0/com.demo/cache/62970296558.jpg
除了WXImageObject对象的构建,其他代码完全一样
错误代码调起的时候logcat可以看到下列错误:
E/Instrumentation: Uninitialized ActivityThread, likely app-created Instrumentation, disabling AppComponentFactory
at android.app.Instrumentation.getFactory(Instrumentation.java:1225)
at android.app.Instrumentation.newActivity(Instrumentation.java:1216)
at com.tencent.mm.splash.k.newActivity(SourceFile:61)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2854)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3078)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6854)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:860)