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
336 stars 39 forks source link

Crash while exporting contacts #60

Closed xhajt03 closed 1 year ago

xhajt03 commented 1 year ago

Hello, I keep getting crashes while trying to export contacts:

09-15 15:14:56.420 8622 8622 E AndroidRuntime: FATAL EXCEPTION: main 09-15 15:14:56.420 8622 8622 E AndroidRuntime: Process: com.github.tmo1.sms_ie, PID: 8622 09-15 15:14:56.420 8622 8622 E AndroidRuntime: android.database.sqlite.SQLiteException: unknown error (code 0 SQLITE_OK): Unable to convert BLOB to string 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at android.database.CursorWindow.nativeGetString(Native Method) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at android.database.CursorWindow.getString(CursorWindow.java:469) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:53) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at android.database.CursorWrapper.getString(CursorWrapper.java:141) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at com.github.tmo1.sms_ie.ImportExportContactsKt.contactsToJSON(ImportExportContacts.kt:135) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at com.github.tmo1.sms_ie.ImportExportContactsKt.access$contactsToJSON(ImportExportContacts.kt:1) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at com.github.tmo1.sms_ie.ImportExportContactsKt$contactsToJSON$1.invokeSuspend(Unknown Source:13) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678) 09-15 15:14:56.420 8622 8622 E AndroidRuntime: at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

The generated file ends with the following fragment within raw_contacts.contacts_data section (personal information replaced with XXXXX and YYYYYY):

      {
        "account_type": "com.google",
        "data_version": "2",
        "photo_file_id": "8",
        "display_name_alt": "XXXXXX",
        "sort_key_alt": "XXXXXX",
        "last_time_used": "0",
        "starred": "1",
        "has_phone_number": "1",
        "raw_contact_id": "1794",
        "carrier_presence": "0",
        "contact_last_updated_timestamp": "1662806182701",
        "photo_uri": "content://com.android.contacts/display_photo/8",
        "data_sync4": "12",
        "phonebook_bucket": "1",
        "times_used": "0",
        "display_name": "XXXXXX",
        "sort_key": "XXXXXX",
        "data_sync1": "3450259296 3450259296 Sync_High_Res",
        "version": "27",
        "data_sync2": "EhAzYjI0ODFlNjhlZWFjMTE5KAIwve_5eg==",
        "data_sync3": "EhAzYjI0ODFlNjhlZWFjMTE5KAIwve_5eg==",
        "photo_thumb_uri": "content://com.android.contacts/contacts/1794/photo",
        "in_default_directory": "1",
        "times_contacted": "0",
        "_id": "10658",
        "account_type_and_data_set": "com.google",
        "name_raw_contact_id": "1794",
        "phonebook_bucket_alt": "1",
        "last_time_contacted": "0",
        "pinned": "0",
        "is_primary": "1",
        "photo_id": "10658",
        "contact_id": "1794",
        "in_visible_group": "1",
        "phonebook_label": "A",
        "account_name": "YYYYYY",
        "display_name_source": "40",
        "dirty": "0",
        "sourceid": "3b2481e68eeac119",
        "phonetic_name_style": "0",
        "send_to_voicemail": "0",
        "lookup": "2322i3b2481e68eeac119",
        "phonebook_label_alt": "A",
        "is_super_primary": "0",
        "raw_contact_is_user_profile": "0",
        "mimetype": "vnd.android.cursor.item/photo",
        "data14": "8",
        "hash_id": "MrogkbdS2enmlQPtY66ALpUVE2Y=\n"

The referenced contact indeed has a photo attached to it (unlike some other contact which was exported to the file correctly).

tmo1 commented 1 year ago

Duplicate of #50

tmo1 commented 1 year ago

This was fixed a couple of weeks ago. The fix will be in the next release.

Thanks, though, for the report.

xhajt03 commented 1 year ago

I see, sorry for having missed the other report and thanks to you for fixing it.