leancloud / LeanCloudChatKit-Android

95 stars 33 forks source link

发送图片消息报错 #83

Closed SXiaoXu closed 5 years ago

SXiaoXu commented 5 years ago

来自用户反馈: https://forum.leancloud.cn/t/android-demo/20411/1

我运行 ChatKit 测试,发送文字消息正常,无法发送图片。

发送图片消息日志如下:

2019-06-11 12:18:13.974 5307-5405/cn.leancloud.imkitapplication D/===AVOS Cloud===: LogUtil$avlog->d->43: curl -X POST  -H "X-LC-Id: dYRQ8YfHRiILshUnfFJu2eQM-gzGzoHsz" -H "X-LC-Key: YourAppKey"  -H "Content-Type: application/json"   -d '{"name":"IMG_20190611_120906.jpg","metaData":{"owner":"","_checksum":"","size":201510,"_name":"IMG_20190611_120906.jpg"},"mime_type":"image/jpeg","key":"ThtymJ8LeJz7kebBhf2CiONLGwIEGuV4X2CXvIEb.jpg","__type":"File"}' https://dyrq8yfh.api.lncld.net/1.1/fileTokens
2019-06-11 12:18:13.983 5307-5405/cn.leancloud.imkitapplication W/mkitapplicatio: Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (light greylist, reflection)
2019-06-11 12:18:13.983 5307-5405/cn.leancloud.imkitapplication W/mkitapplicatio: Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (light greylist, reflection)
2019-06-11 12:18:13.983 5307-5405/cn.leancloud.imkitapplication W/mkitapplicatio: Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (light greylist, reflection)
2019-06-11 12:18:14.072 5307-5405/cn.leancloud.imkitapplication W/mkitapplicatio: Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (light greylist, reflection)
2019-06-11 12:18:14.133 5307-5333/cn.leancloud.imkitapplication D/EGL_emulation: eglMakeCurrent: 0xe9c85360: ver 3 0 (tinfo 0xe9c836a0)
2019-06-11 12:18:14.168 5307-5405/cn.leancloud.imkitapplication W/mkitapplicatio: Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->getAlpnSelectedProtocol()[B (light greylist, reflection)
2019-06-11 12:18:14.224 5307-5405/cn.leancloud.imkitapplication D/===AVOS Cloud===: LogUtil$avlog->d->43: {"objectId":"5cff2b8643e78c0067e1ead6","createdAt":"2019-06-11T04:18:14.314Z","token":"w6ZYeC-arS2makzcotrVJGjQvpsCQeHcPseFRDzJ:OT0H1jIWE92WozOejCfd_3cOZMw=:eyJpbnNlcnRPbmx5IjoxLCJzY29wZSI6ImRZUlE4WWZIIiwiZGVhZGxpbmUiOjE1NjAyMzAyOTR9","url":"http:\/\/lc-dYRQ8YfH.cn-n1.lcfile.com\/ThtymJ8LeJz7kebBhf2CiONLGwIEGuV4X2CXvIEb.jpg","mime_type":"image\/jpeg","provider":"qiniu","upload_url":"https:\/\/upload.qiniup.com","bucket":"dYRQ8YfH","key":"ThtymJ8LeJz7kebBhf2CiONLGwIEGuV4X2CXvIEb.jpg"}
2019-06-11 12:18:14.227 5307-5405/cn.leancloud.imkitapplication D/===AVOS Cloud===: LogUtil$avlog->d->43: curl -X POST  -H "X-LC-Id: dYRQ8YfHRiILshUnfFJu2eQM-gzGzoHsz" -H "X-LC-Key: YourAppKey"  -H "Content-Type: application/json"   -d '{"result":false,"token":"w6ZYeC-arS2makzcotrVJGjQvpsCQeHcPseFRDzJ:OT0H1jIWE92WozOejCfd_3cOZMw=:eyJpbnNlcnRPbmx5IjoxLCJzY29wZSI6ImRZUlE4WWZIIiwiZGVhZGxpbmUiOjE1NjAyMzAyOTR9"}' https://dyrq8yfh.api.lncld.net/1.1/fileCallback
2019-06-11 12:18:14.231 5307-5307/cn.leancloud.imkitapplication E/LCChatKit: cn.leancloud.chatkit.activity.LCIMConversationFragment$10 done():588 
    com.avos.avoscloud.im.v2.AVIMException: com.avos.avoscloud.AVException: com.avos.avoscloud.AVException: java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/IMG_20190611_120906.jpg (Permission denied)
        at com.avos.avoscloud.im.v2.callback.AVIMConversationCallback.internalDone0(AVIMConversationCallback.java:21)
        at com.avos.avoscloud.im.v2.callback.AVIMConversationCallback.internalDone0(AVIMConversationCallback.java:10)
        at com.avos.avoscloud.AVCallback.internalDone(AVCallback.java:18)
        at com.avos.avoscloud.AVCallback.internalDone(AVCallback.java:27)
        at com.avos.avoscloud.im.v2.AVIMConversation$1.done(AVIMConversation.java:251)
        at com.avos.avoscloud.SaveCallback.internalDone0(SaveCallback.java:40)
        at com.avos.avoscloud.SaveCallback.internalDone0(SaveCallback.java:30)
        at com.avos.avoscloud.AVCallback.internalDone(AVCallback.java:18)
        at com.avos.avoscloud.AVCallback.internalDone(AVCallback.java:27)
        at com.avos.avoscloud.im.v2.messages.AVIMFileMessage$1.done(AVIMFileMessage.java:154)
        at com.avos.avoscloud.SaveCallback.internalDone0(SaveCallback.java:40)
        at com.avos.avoscloud.SaveCallback.internalDone0(SaveCallback.java:30)
        at com.avos.avoscloud.AVCallback$1.run(AVCallback.java:12)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        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:858)
     Caused by: com.avos.avoscloud.AVException: com.avos.avoscloud.AVException: java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/IMG_20190611_120906.jpg (Permission denied)
        at com.avos.avoscloud.upload.QiniuSlicingUploader.doWork(QiniuSlicingUploader.java:104)
        at com.avos.avoscloud.upload.FileUploader.doWork(FileUploader.java:80)
        at com.avos.avoscloud.upload.HttpClientUploader$1.run(HttpClientUploader.java:109)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: com.avos.avoscloud.AVException: java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/IMG_20190611_120906.jpg (Permission denied)
        at com.avos.avoscloud.AVFile.getDataStream(AVFile.java:753)
        at com.avos.avoscloud.upload.QiniuSlicingUploader.doWork(QiniuSlicingUploader.java:57)
        at com.avos.avoscloud.upload.FileUploader.doWork(FileUploader.java:80) 
        at com.avos.avoscloud.upload.HttpClientUploader$1.run(HttpClientUploader.java:109) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
     Caused by: java.io.FileNotFoundException: /storage/emulated/0/DCIM/Camera/IMG_20190611_120906.jpg (Permission denied)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:231)
        at java.io.FileInputStream.<init>(FileInputStream.java:165)
        at com.avos.avoscloud.AVPersistenceUtils.getInputStreamFromFile(AVPersistenceUtils.java:182)
        at com.avos.avoscloud.AVFile.getDataStream(AVFile.java:751)
        at com.avos.avoscloud.upload.QiniuSlicingUploader.doWork(QiniuSlicingUploader.java:57) 
        at com.avos.avoscloud.upload.FileUploader.doWork(FileUploader.java:80) 
        at com.avos.avoscloud.upload.HttpClientUploader$1.run(HttpClientUploader.java:109) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 
2019-06-11 12:18:14.363 5307-5412/cn.leancloud.imkitapplication D/===AVOS Cloud===: LogUtil$avlog->d->43: {}
jwfing commented 5 years ago

/storage/emulated/0/DCIM/Camera/IMG_20190611_120906.jpg (Permission denied) 这是没有授予本地存储的读取权限导致的。