Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞 [BUG] Error restoring a SMS backup copy #70

Closed
Ilya-Ezhik opened this issue Mar 7, 2024 · 47 comments · Fixed by #311
Closed

🐞 [BUG] Error restoring a SMS backup copy #70

Ilya-Ezhik opened this issue Mar 7, 2024 · 47 comments · Fixed by #311
Labels
bug Something isn't working help wanted Extra attention is needed important

Comments

@Ilya-Ezhik
Copy link

When trying to restore an SMS from a backup, an error occurs when reading the copy file.

Steps to reproduce the behavior:

  1. Go to "Menu --> Backup"
  2. Click on "Restore"
  3. Select the copy file
  4. Click "OK"

The dialog box will contain a description of the error "it is impossible to read the backup file"

  • Device: Samsung Galaxy A22 5G (as well as all other devices)
  • OS: Android 13, One UI Core 5.1 (and other Android OS
  • App Version 4.0.7 (latest)

Screenshot_20240307_022132

@Ilya-Ezhik Ilya-Ezhik added the bug Something isn't working label Mar 7, 2024
@octoshrimpy
Copy link
Owner

Looking now.

@Ilya-Ezhik
Copy link
Author

Looking now.

Thanks! There is also a problem with group SMS sending, but for this probably need to open a new topic?

@octoshrimpy
Copy link
Owner

re is also a problem with group SMS sending, but for this probably need to open a new topic?

yes please.

@octoshrimpy
Copy link
Owner

looks like this may be because quik never asked for access to files, only media. it never writes a backup. I'm assuming it's the same problem when importing a backup. did this work with QKSMS?

@Ilya-Ezhik
Copy link
Author

it never writes a backup.

When creating a backup, it creates a JSON file in the selected folder on the phone with all SMS (headers from the phone number and SMS text)! And then he can't read it (described above)

@Ilya-Ezhik
Copy link
Author

Idid this work with QKSMS?

Yes, in that application, a backup is created and successfully restored! Without problems!

@octoshrimpy
Copy link
Owner

it never writes a backup.

When creating a backup, it creates a JSON file in the selected folder on the phone with all SMS (headers from the phone number and SMS text)! And then he can't read it (described above)

and you can open the json with another file viewer/editor without problem? I wonder if I have remnants of some debug build from testing directly from android studio that is interfering. mine isn't storing the file at all, which is even worse.

@Ilya-Ezhik
Copy link
Author

and you can open the json with another file viewer/editor without problem?

Yes! I open it on phone using the MT Manager app without any problems! :)

Screenshot_20240308_002309_MT Manager

@edent
Copy link

edent commented Mar 18, 2024

I'm having the same issue. Both phones are use V4.0.7.

I have manually copied across the JSON file. When I try to open it in the app I get the error "Couldn't read backup file".

I can create a backup into a specific folder. But if I try to read that newly created backup on the same phone, I get that error.

The JSON file is valid and look like:

{
	"messageCount": 765,
	"messages": [
		{
			"address": "+447700900123",
			"body": "I need to order a cake for my friend's birthday in a few days.♡",
			"date": 1703340489087,
			"dateSent": 0,
			"locked": false,
			"protocol": 0,
			"read": true,
			"status": -1,
			"subId": 3,
			"type": 1
		},

Although it starts with a few "blank" entries like:

		{
			"address": "",
			"body": "",
			"date": 1511875195000,
			"dateSent": 1511875195000,
			"locked": false,
			"protocol": 0,
			"read": true,
			"status": -1,
			"subId": -1,
			"type": 2
		},
		{
			"address": "+4407700900321,
			"body": "",
			"date": 1511875284000,
			"dateSent": 1511875284000,
			"locked": false,
			"protocol": 0,
			"read": true,
			"status": -1,
			"subId": -1,
			"type": 1
		},

(Phone numbers replaced with fakes by me)

@esan0
Copy link

esan0 commented Mar 20, 2024

Same issue.

@octoshrimpy
Copy link
Owner

looking into it. I have some large life changes coming up in the next couple months so I cannot guarantee a fix soon, but am trying to find the issue.

@octoshrimpy octoshrimpy added help wanted Extra attention is needed important and removed waiting for reply labels Mar 20, 2024
@octoshrimpy octoshrimpy changed the title [BUG] Error restoring a SMS backup copy 🐞 [BUG] Error restoring a SMS backup copy Mar 31, 2024
@octoshrimpy octoshrimpy pinned this issue Mar 31, 2024
@engelhro
Copy link

Any news on this issue?

I'm affected as well. Switched from one phone to a new one today, and now I can't import my backup and all its messages. Would be really nice if this could be fixed 👍.

Thanks a lot for a short update!

@SanskritFritz
Copy link

Just a heads-up, a workaround: QKSMS is able to restore the backups made with QUIK.

@engelhro
Copy link

Just a heads-up, a workaround: QKSMS is able to restore the backups made with QUIK.

Yeah, I've seen that afterwards and it indeed helped to solve my issue! 😀

The problem existing in QUIK but not already in QKSMS should hopefully help the developer to more easily identify and fix the problem.

Would still be nice to see a working restore functionality also in the "revived" app which is QUIK.

@b-risk
Copy link

b-risk commented Jun 2, 2024

Hi, I'm having a similar issue too, I made a backup with this revived app on my phone and I transferred it to my computer, after wiping my phone (so no making a new backup) and installing GrapheneOS and restoring from the file in settings it gives an error where it says "couldn't read"

@antistress
Copy link

Same bug here with latest version from F-Droid (4.0.7) on my new Galaxy S10e with lineage-20.0-20240608-nightly
And same workaround : I had to use QKSMS to import the backup file and then QUIK to synchronise itself with QKSMS

@Saarsk
Copy link

Saarsk commented Jun 21, 2024

Here was my workaround:

I used the app "SMS Import / Export" available from F-Droid.

You might want to check the Readme. There were no issues for me, but if you have group messages etc. there might be issues.

All I did was tap "import" and it appeared in QUIK. I see there's an option in QUIK to re-synch with the native SMS database.

@MoralCode
Copy link

Here was my workaround:

I used the app "SMS Import / Export" available from F-Droid.

You might want to check the Readme. There were no issues for me, but if you have group messages etc. there might be issues.

All I did was tap "import" and it appeared in QUIK. I see there's an option in QUIK to re-synch with the native SMS database.

This seemed to work for me, and also seemed to import MMS, which I suspect the built in importer doesn't do.

@rafnov
Copy link

rafnov commented Oct 23, 2024

Same on me.
Successfuly created backup .json (quite small - 1,17 MB) on Realme 7 Pro, uploaded to Google drive, then downloaded od Realme GT Neo 2 and tried to restore: unable to read a file. 😟
Any chances for soon fix? It's been some time since Quik was updated...

@wrenix
Copy link

wrenix commented Oct 25, 2024

I use https://github.com/tmo1/sms-ie for this Problem now

@rafnov
Copy link

rafnov commented Oct 25, 2024

Ok, it worked perfectly for me too, but that doesn't fix anything in Quik.

@dex2000
Copy link

dex2000 commented Nov 12, 2024

FYI: it was broken in 4.06 too

@SzellenDienw
Copy link

Hello, it seems to me that QUIK can import .XML files.

@dex2000
Copy link

dex2000 commented Jan 24, 2025

it should import his own backup-files...

@octoshrimpy
Copy link
Owner

I believe the issue is with permissions, as android permissions from when QKSMS was last updated vs now are very different. I'm trying to wrangle those permissions, as i'm having problems with camera as well.

@dex2000
Copy link

dex2000 commented Jan 26, 2025

i dont think that changes of android permissions is the problem.

(Last qkms-update-> January> 23,
last update my android->Nov 20 ...
qksms works as expected quik not)

@octoshrimpy
Copy link
Owner

you also have to take into consideration the version of android QKSMS was compiled against, vs quik. quik is compiled against a newer version of the SDK, one where the permissions were deprecated.

@dex2000
Copy link

dex2000 commented Jan 28, 2025

i have compared now the permissions and see that qksms have additional
"access to all networks"
but this should not be the problem or?

(all other permissions are the same)

@MoralCode
Copy link

i have compared now the permissions and see that qksms have additional

Where/how did you compare them? if you just looked at the permissions settings menus for each app in the UI of your device, theres a good chance that the underlying technical identifiers for each permission may have changed without being visible on that menu.

For example, i think newer versions of android allow more granular file access permissions, where, if an app needs access to photos, you can select groups, or even individual photos to allow access to, rather than it being "all or nothing" with your entire camera roll.

@dex2000
Copy link

dex2000 commented Jan 29, 2025

i have compared now the permissions and see that qksms have additional

Where/how did you compare them? if you just looked at the permissions settings menus for each app in the UI of your device,

Yep.

theres a good chance that the underlying technical identifiers for each permission may have changed without being visible on that menu.

I'm a user not an app developer.
I dont understand that two nearly identical Apps on same (!) one device are different working (or not working like here).

@MoralCode
Copy link

MoralCode commented Jan 30, 2025

I'm a user not an app developer. I dont understand that two nearly identical Apps on same (!) one device are different working (or not working like here).

It's okay If you aren't a dev! As someone who has played both roles, I figured it was worth asking the question to clarify, both to help octoshrimpy understand your point, and also to offer an explanation for how your observation and octoshrimpy's assertion that the permissions had changed could both be true at the same time.

@octoshrimpy
Copy link
Owner

@dex2000: @MoralCode is 100% correct. Any help is good help (and bad help is just Quality Control!) If you'd like to learn, here's a great place to start on the topic:

android SDK docs
quik's permissions

@ivan-lt
Copy link

ivan-lt commented Feb 16, 2025

I have the same issue, that is:

  • install QUIK afresh, run it, agree to use it as a default messaging app;
  • go to Backup and restore;
  • set Backup location (I set it to Download/temp as I heard Android might be more permissive in the Download folder, don't know whether it's true); at this time the OS asks "Allow QUIK to access files in temp?", to which I agree;
  • tap Backup now and get a message "Backing up messages / Finished!"; the file is created and contains the following:
{
 "messageCount": 0,
 "messages": []
}
  • tap Restore, get file selection screen, select the newly created file, and...
  • get the Error / Couldn't read backup file.

I'm using QUIK 4.0.10-beta (Obtainium says it's 4.0.11), Pixel 7a, GrapheneOS. It didn't ask for any additional permissions. Didn't test QKSMS as the issue was not pressing but having a working import/export would definitely be nice. Thanks for your work on this app!

@MoralCode
Copy link

It didn't ask for any additional permissions.

what if you go into the app's info screen and give it as many filesystem related permissions as youre able to allow - does that change the behavior of whats included in the backup file?

@ivan-lt
Copy link

ivan-lt commented Feb 16, 2025

what if you go into the app's info screen and give it as many filesystem related permissions as youre able to allow -

There are "Music and audio" and "Photos and videos", and they are allowed. In fact, it says "No permissions denied".

does that change the behavior of whats included in the backup file?

Actually there's nothing wrong with the file's contents because it was a fresh install with no messages. In fact, I've sent an SMS, made another backup and the message is duly reflected in the new file. The "Couldn't read backup file" error persists, however. (On both files.)

@dex2000
Copy link

dex2000 commented Feb 16, 2025

@MoralCode i dont understand your answers here.
Is it working at you? On which config?

Maybe it could be help the lot of people where its broken.

@ivan-lt all what i understand here (with my small english-knowledge): you have to learn programming languages and fix it yourself.

@dex2000
Copy link

dex2000 commented Feb 21, 2025

I'm a noob and you know it, but:

fun getRestoreProgress(): Observable<Progress>

looks very really logical, but in qksms are the last lines otherwise (stop comes first) any ideas?

@Inhishonor
Copy link
Contributor

I was experimenting with this, and for some reason, when QUIK is not set as the default messaging app, it is able to restore the backup. This seems to confirm that permissions are the issue, though, I am not sure why being the default app is causing the problem.

@ivan-lt
Copy link

ivan-lt commented Feb 23, 2025

I was experimenting with this, and for some reason, when QUIK is not set as the default messaging app, it is able to restore the backup.

That would be an awesome workaround, however, I can't reproduce it here -- even when QUIK is not set as the default app, it can't read backup files, neither old nor new. Rebooting doesn't help.

@Inhishonor
Copy link
Contributor

Inhishonor commented Feb 23, 2025

That would be an awesome workaround, however, I can't reproduce it here -- even when QUIK is not set as the default app, it can't read backup files, neither old nor new. Rebooting doesn't help.

What Android version are you using? In my reading regarding this, I found that Google recently changed the Android file permissions, which is what's causing this problem, I think.
UPDATE: When using a locally built version of QUIK, on Android 15, I am able to restore the messages. I don't know how to explain this...

@ivan-lt
Copy link

ivan-lt commented Feb 23, 2025

What Android version are you using?

Android 15 (GrapheneOS)

@Inhishonor
Copy link
Contributor

Inhishonor commented Feb 23, 2025

I see, are you able to build this locally to test? @octoshrimpy After doing some research the issue may be with the proguard rules, they are the same as QKSMS but the code for Backup and Restore has changed quite a bit since then, and those rules are over 6 years old.

@oowais
Copy link

oowais commented Feb 23, 2025

@Inhishonor you made me happy for a second, but it didn't work, I have the same problem as @ivan-lt mentioned. I am also using Graphene OS, Android 15.
Here are some logs that were collected during my process:

  • Install QUIK (4.0.7) from Driodify
  • Open app, and disallow it to be the default messaging app
  • Open backup and store settings menu
  • Set backup folder location
  • Select Restore option and select file
  • "Couldn't read backup file"

QUIK log 7cc318b070d6.txt

@Inhishonor
Copy link
Contributor

@Inhishonor you made me happy for a second, but it didn't work, I have the same problem as @ivan-lt mentioned. I am also using Graphene OS, Android 15.
Here are some logs that were collected during my process:

  • Install QUIK (4.0.7) from Driodify
  • Open app, and disallow it to be the default messaging app
  • Open backup and store settings menu
  • Set backup folder location
  • Select Restore option and select file
  • "Couldn't read backup file"

Sorry, I realized that when that happened, it was only because I had been running a locally built app. It was not due to the fact that I had revoked and then re-enabled default messaging.
Also, thank you for the log. I will take a look at that and see if I can figure it out.

@Inhishonor
Copy link
Contributor

I have narrowed it down to proguard as the culprit, with it disabled even on a release build, I was able to backup and restore.

@Inhishonor
Copy link
Contributor

I submitted pull request #311 that modifies the proguard rules to allow the restore functionality to access the files. I confirmed this works across two devices, each running different android versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed important
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.