tmo1 / sms-ie

SMS Import / Export is a simple Android app that imports and exports SMS and MMS messages, call logs, and contacts from and to JSON / NDJSON files.
GNU General Public License v3.0
319 stars 38 forks source link

Error when importing sms #103

Closed farzadx closed 1 year ago

farzadx commented 1 year ago

Hi When i import messages i get error My phone is poco x3 pro Android 12

Screenshot_2023-03-11-15-48-58-316_com github tmo1 sms_ie

tmo1 commented 1 year ago

https://github.com/tmo1/sms-ie#posting-json https://github.com/tmo1/sms-ie#crashes

farzadx commented 1 year ago

logs.txt

farzadx commented 1 year ago

messages-2023-03-12.json.txt

tmo1 commented 1 year ago

Thank you - I'm looking into this.

farzadx commented 1 year ago

Thanks . Will there be any fix ? 😢

tmo1 commented 1 year ago

I can't find any trace of the error message you're seeing online, but I hope I can fix the problem. I have something I'll try when I get a chance.

tmo1 commented 1 year ago

I have been unable to reproduce the problem using the JSON file you provided on various (emulated) Android images, including an Android 12 (API 31) one - in my tests, the two SMS messages import correctly, without error. Is your Poco X3 Pro using MIUI, or something closer to stock Android, like LineageOS?

farzadx commented 1 year ago

Miui

tmo1 commented 1 year ago

If the problem can't be reproduced on regular Android, there's not much I can do to troubleshoot. Just guessing from the error message (about which I can't find anything online, as above, perhaps because it's not a standard Android error message), you might try removing the "deleted": "0" lines from the JSON and seeing if that lets the improt work. If it does, I can provide a script or jq invocation that automates the process.

farzadx commented 1 year ago

I recover my messages with other phone, ok i will try , thanks

t-e-s-tweb commented 1 year ago

If the problem can't be reproduced on regular Android, there's not much I can do to troubleshoot. Just guessing from the error message (about which I can't find anything online, as above, perhaps because it's not a standard Android error message), you might try removing the "deleted": "0" lines from the JSON and seeing if that lets the improt work. If it does, I can provide a script or jq invocation that automates the process.

I had similar issue on miui 14. After I deleted "deleted 0" and "sync state 0" completely from the file on the latest beta 2.0 pre version, I was able to restore my SMS. A total of 14000+ SMS so the backup was absolutely necessary.

tmo1 commented 1 year ago

I had similar issue on miui 14. After I deleted "deleted 0" and "sync state 0" completely from the file on the latest beta 2.0 pre version, I was able to restore my SMS.

Thank you for the report. I plan to document this problem and solution in the README and close this issue.

FTR, removing all the deleted keys from the JSON can be done with the jq tool:

~$ jq 'del(.[].display_name)' messages-nnn.json > messages-nnn-MIUI-stripped.json

where messages-nnn.json is the name of the original JSON file, and messages-nnn-MIUI-stripped.json is a file to write the stripped JSON to.

To remove both the deleted and sync_state keys, run:

~$ jq 'del(.[] ["deleted", "sync_state"])' messages-nnn.json > messages-nnn-MIUI-stripped.json