[ODK Community] odk-collect: error loading existent .formdef & cached files

Hi Pau,

Deleting a form with the Form Manager from ODK's main menu should also
delete the cached files. It appears to not be happening, however, so I've
filed a bug here:
http://code.google.com/p/opendatakit/issues/detail?id=98

The instance in FormLoaderTask that you're referring to is referencing a
form that you started filling out and saved to be edited later. If you're
loading a form with 'enter new data', the instance should be null.

You can also connect your phone to a computer, mount the SDCard, browse to
/sdcard/odk and delete the .cache folder (or just all the files in it).

The reason ODK tries to use the cached files when loading a form is that
they're significantly faster than loading from raw .xml, especially for
larger forms. I'm not sure what code you're migrating forward, but it's
something to keep in mind.

-Carl

··· On Fri, Jul 16, 2010 at 4:16 AM, Pau Varela wrote:

hi,

I migrated some code from an old odk-collect version to the newest one
(1.1.4), and I couldn't load the forms until I completely removed the
/sdcard/odk/.cache/ directory in the device. I've noticed those cached
files never get removed, and experienced some problems before, and
that's why I suspected them.

The error I was getting is a NPE kind of related to javarosa FormDef
class: initialize(true) method, calling
preloadInstance(instance.getRoot()), instance seems to be null.
initialize(true) is called from odk's FormLoaderTask:170, and I 'm not
sure whether the problems comes strictly from javarosa or also the way
odk creates the FormDef... I've saved the stack trace in case anyone
wants to see it.

Question for ODK is if there is any way to remove the cached files
without having to run device's shell and delete them manually.

thanks and regards,

pau.

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.comopendatakit%2Bunsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

hi Carl,

thanks for your reply.

we don't use the Form Manager (MainMenuActivity is disabled in the
AndroidManifest.xml), but call directly the FormEntryActivity from our
application. form templates are synced and downloaded from a server
and I guess that's why they don't get deleted when updated
(additionally when developing I push directly the forms through
Eclipse). Maybe I should delete the cached files after download a form
template..

Also, we don't save the filled forms in the sdcard as a file, but into
an internal DB as xml string. I'm pretty sure the application had no
data when I tested it (I uninstalled it), so it was a problem with the
existent cached files which, from my understanding, are produced from
the form template and not from the filled data. I don't know if
something has changed in the serialization/deserialization process,
but the warning before the error says:

WARN/System.err(21521):
org.javarosa.core.util.externalizable.DeserializationException: No
datatype registered to serialization code [57 bb 5e 00]

So it seems to me the templates serialized with an old odk version are
not readable by the latest one. after removing the cached files and
letting odk produce them again, it worked perfectly.

That's why I was wondering if there was a sort of onUpgrade method
like the available to handle DB versioning, so maybe it would be
possible to do some actions (delete cached files) when upgrading to a
new odk version.

I believe it would be a nice feature, in case you've distributed
several phones with your application running on it, and you don't want
the users messing it up with the sdcard, or when there is no computer
where to plug your device.. update processes should be painless! :wink:

But I can probably delete them from our application and I also
understand we are using odk in a very particular way and the update
was from a very old version. maybe the error is so rare it doesn't
even deserve a bug ticket :wink: Anyway, I thought it was a good thing to
report the issue

thanks again and regards,

pau.

··· 2010/7/16 Carl Hartung : > Hi Pau, > Deleting a form with the Form Manager from ODK's main menu should also > delete the cached files. It appears to not be happening, however, so I've > filed a bug here: > http://code.google.com/p/opendatakit/issues/detail?id=98 > The instance in FormLoaderTask that you're referring to is referencing a > form that you started filling out and saved to be edited later. If you're > loading a form with 'enter new data', the instance should be null. > You can also connect your phone to a computer, mount the SDCard, browse to > /sdcard/odk and delete the .cache folder (or just all the files in it). > The reason ODK tries to use the cached files when loading a form is that > they're significantly faster than loading from raw .xml, especially for > larger forms. I'm not sure what code you're migrating forward, but it's > something to keep in mind. > -Carl > > > > On Fri, Jul 16, 2010 at 4:16 AM, Pau Varela wrote: >> >> hi, >> >> I migrated some code from an old odk-collect version to the newest one >> (1.1.4), and I couldn't load the forms until I completely removed the >> /sdcard/odk/.cache/ directory in the device. I've noticed those cached >> files never get removed, and experienced some problems before, and >> that's why I suspected them. >> >> The error I was getting is a NPE kind of related to javarosa FormDef >> class: initialize(true) method, calling >> preloadInstance(instance.getRoot()), instance seems to be null. >> initialize(true) is called from odk's FormLoaderTask:170, and I 'm not >> sure whether the problems comes strictly from javarosa or also the way >> odk creates the FormDef... I've saved the stack trace in case anyone >> wants to see it. >> >> Question for ODK is if there is any way to remove the cached files >> without having to run device's shell and delete them manually. >> >> thanks and regards, >> >> pau. >> >> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >