Re: Sync via copying "collection.anki2" and "collection.media.db" between AnkiDroid's folder and Anki 2.0 folder

857 views
Skip to first unread message

iniju

unread,
Aug 20, 2012, 2:27:40 AM8/20/12
to anki-a...@googlegroups.com, ovgo...@gmail.com, jonko...@gmail.com
I believe it should be OK to copy the files like that, but you have to make sure that both ankidroid and anki desktop are NOT running at that time.

Also, if you see any other files named like collection.anki2-* or collection.media.db-* in the anki folder or the ankidroid folder, then it probably won't work.
In that case try opening and closing anki or ankirdroid (depending on which side has the extra files) again and see if these extra files disappear. Typical names for these problematic files are:
collection.anki2-journal, collection,anki2-shm, collection.anki2-wal and similarly for collection.media.db

If you can't get rid of these files (also known as journal files) at least make sure you copy them to along with collection.anki2 and collection.media.db.

Manually deleting these files or not copying them along will most probably corrupt your collection.
These files normally appear when the application (ankidroid or anki) is still running or if it crashed or not terminated normally.

Hope that helps
Kostas


On Monday, 20 August 2012 04:19:34 UTC+1, jonko...@gmail.com wrote:
I don't have an answer but this is important to me as well...being about to study on my tablet, then manually copy over the deck (without Ankiweb) to my desktop to add cards, edit decks, and study, then move them back to my tablet would be awesome.

On Wednesday, August 15, 2012 3:10:19 AM UTC+8, ovgo...@gmail.com wrote:
I tried to overwrite Anki's 2.0 files with the files from AnkiDroid (I mean "collection.anki2" and "collection.media.db"). I did it because at the time I didn't have an Internet connection and couldn't use AnkiWeb to sync therefore.
Anki 2.0 wrote that the database was corrupted. "Check database" didn't help.

Is it OK to sync by blatant copying database files in 2.0 version?  I did it in the 1.x versions of the programs and everything worked fine.

iniju

unread,
Aug 20, 2012, 10:26:15 AM8/20/12
to anki-a...@googlegroups.com, ovgo...@gmail.com, jonko...@gmail.com
Yes, that is my expectation, too. Glad you solved the issue.

Kostas


On Monday, 20 August 2012 14:14:19 UTC+1, ovgo...@gmail.com wrote:
I've just checked. It works! Thank you! You helped me a lot.
When "Back" button is pressed while AnkiDroid is in main menu, the application mimimizes, but work all shm and wal files and delete them. So, I think this Back may be used instead of missing Exit button.

Nicolas Raoul

unread,
Aug 20, 2012, 10:30:52 AM8/20/12
to anki-a...@googlegroups.com, ovgo...@gmail.com, jonko...@gmail.com
Does it *always* work?
I am not an Android expert, but I think that if there is a lot of free
memory, applications are sometimes not closed even if backing from the
main activity.
Waiting for everyone's feedback!

Nicolas Raoul
> --
> You received this message because you are subscribed to the Google Groups
> "AnkiDroid" group.
> To view this discussion on the web, visit
> https://groups.google.com/d/msg/anki-android/-/75e0xErOCB4J.
>
> To post to this group, send an email to anki-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> anki-android...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/anki-android?hl=en-GB.

Flavio Lerda

unread,
Aug 20, 2012, 11:23:27 AM8/20/12
to anki-a...@googlegroups.com, ovgo...@gmail.com, jonko...@gmail.com
I think the reason why the journal files are deleted is that AnkiDroid
closes all the database when all activities are closed, so that should
be reproducible.

The application is very likely to still be running, as the system is
unlikely to close it just because the use has backed out of all
activities.

You can check if the application is running by using something like:
adb shell ps | grep com.ichi2.anki

Note that in Android application usually do not quit.
It is up to the system whether to keep the application running or not.
However, applications should be well behaved and not keep a hold of
unnecessary resources.

In the case of AnkiDroid, I believe if the system is updating a
notification or updating the content of the widget, they the
application will keep the database open, as it is needed in that case.
Moreover, I think most of AnkiDroid's long running AsyncTasks are not
stopped when there are no running activities, which might be something
we can improve upon.

For a discussion of why application do not usually quit, see:
http://stackoverflow.com/questions/2033914/quitting-an-application-is-that-frowned-upon

my 2c
-Flavio

On Mon, Aug 20, 2012 at 4:12 PM, <ovgo...@gmail.com> wrote:
> I'm not sure is it always works. I just tested it only once.
> Anyway, it's not clear to a new user if pressing Back will write all the
> changes to the Database. I think there should be an explicit button to exit
> AnkiDroid and write all changes to DB.
> https://groups.google.com/d/msg/anki-android/-/c8NJ4rb5BxwJ.
>
> To post to this group, send an email to anki-a...@googlegroups.com.
> To unsubscribe from this group, send email to
> anki-android...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/anki-android?hl=en-GB.



--
Flavio Lerda
Reply all
Reply to author
Forward
0 new messages