Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-09-01 Thread Dianne Hackborn
Thank for the update.  I am just very glad to know that it isn't a nasty
platform bug. :)

On Mon, Aug 30, 2010 at 3:49 PM, TreKing treking...@gmail.com wrote:

 PROBLEM SOLVED!

 Conclusion: I'm an idiot (shocked!?)

 So, for those of you that care, here was the problem. I followed Zsolt's
 suggestion to go back to the previous version and then updated the app and
 sure enough it crashed.

 Quick background: The app gets data from the inter webs and then caches it
 in my own format with some extra data for quicker access and to support
 extra functionality. This cache is wiped on each update to refresh the
 data and avoid issues exactly like this.

 At least it's *supposed* to be wiped.

 Unfortunately, while developing the latest version, I
 apparently inadvertently removed the single line of code that clears the
 cache when the app is updated! Genius!

 So the new code was trying to load the old cache which was missing a new
 piece of data (which it otherwise would get from that static map discussed
 earlier).

 I had no idea I'd removed that line to clear the cache so I didn't even
 think it to be a possibility! I assumed all users were getting fresh data.

 Well, now that I've thoroughly embarrassed myself, thank you all for your
 time, sorry to have wasted it on such a stupid oversight, and Zsolt, you're
 my hero for the brain-dead simple idea to try to update the app for
 myself. I should really work that concept into my test plan ...

 Now, if you'll excuse me, I have a proper update to release ...

 Thanks everyone!


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-31 Thread TreKing
On Mon, Aug 30, 2010 at 7:03 PM, Zsolt Vasvari zvasv...@gmail.com wrote:

 I am glad you solved it.  How do you have your warning levels set?  I have
 mine set to the highest possible on everything and a removed line might have
 been caught via unused/unitiliazed varaibles.


Me too! Probably the defaults, but I have no warnings (except the required
minSDK warning) and it wouldn't have been caught anyway. The line that got
removed was a simple static helper function that used the current context to
delete all files in the cache directory. Removing it had no effect on the
surrounding code.

On Mon, Aug 30, 2010 at 7:03 PM, William Ferguson william.ferguson.au@
gmail.com wrote:

 He he, glad you got some closure.


Me too! Thanks!

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-31 Thread TreKing
On Tue, Aug 31, 2010 at 4:30 PM, Zsolt Vasvari zvasv...@gmail.com wrote:

 Yes, but if you declared the helper function private, you may have gotten
 an unused warning.  If it was in a different class, of course, that's no
 help as the compiler doesn't check for unused package private functions,
 even though it could.


Yeah, no, it was a separate class with a static clearCache method that's
used elsewhere as well. I normally do get the unused warning and really
appreciate it for trimming down unnecessary code.

Funny story, BTW, turns out I WAS calling the cache clearing function (I
looked at the diff wrong, I'm way off my game), but it had a bug where it
wasn't clearing the correct cache files. Not as stupid as removing a line of
code, but still pretty stupid.

Released my fix and anxiously await to see what kind of comments I wake up
to!

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-30 Thread TreKing
On Sun, Aug 29, 2010 at 8:24 PM, William Ferguson william.ferguson.au@
gmail.com wrote:

 What's the taskAffinity?


Whatever the default is - I've never touched this.

I suspect that clearing the data is changing the behaviour because this
 speed up / slows down one of the threads, thereby (generally) avoiding the
 race condition.


I have a feature that auto-backs up all user data to the SD and restores it
if the local data file is gone. So even if they clear the local data, it's
restored on the next app start up. So regardless, all user saved data is
there before and after they clear the app's local data storage to alleviate
the problem.

And the crash does not occur in the first activity, where data is usually
loaded. I say usually because it's lazy-loaded (so if the user navigates
away from the second activity and comes back much later, it's possible the
memory got wiped). But this occurs in onCreate in the main thread of the
second activity, and this activity does not try to do anything with the user
data until after the point at which the crash occurs.


 I'd be tempted to
 1) synchronize the method


Probably a good idea, I'll be doing that =)


  2) make the static instance an instance of your Application class.


I started using a custom Application class a while ago and quickly got tired
of having to cast up each time I needed to do something with it. I'll try a
better implementation of a Singleton first.

On Mon, Aug 30, 2010 at 6:16 AM, Zsolt Vasvari zvasv...@gmail.com wrote:

 I think what's happening then is that some kind of race condition corrupts
 your app data, after which the crash will occur every time.


But the main activity that starts up and loads the user data each and every
time does not crash, and the point at which the crash happens is NOT using
user data - it's using a hard-coded reference which is explicitly set in
code. That reference, somehow, ends up being null, even though previously it
was (probably) used in the user-data loading process. WTF!?


 - It started to happen after you introduced static maps.


Weird stuff after updating like this has happened before, though this time
it's much more widespread and consistent.
Also, note that the map itself is not static: there is a static instance of
the class that contains a map. Don't know if that makes a huge difference,
but it's worth pointing out.


 - You admit using such maps in multiple threads
 - java.util.TreeMap is not thread safe.


Yes, but the map is initialized ONCE in the main thread and never altered
again. I'm not adding or removing anything from it at any other point. It's
there strictly to get access to the pre-defined derived-type instances I
need to use depending on the user's selection. Also, no thread is started
until after this map is initialized.


 What I would do is wrap TreeMap around
 a java.util.Collections.syncronizedMap (not 100% about the name) and then
 release an updated app and see if the crashes go away.  I know it makes your
 users the testers, but if you cannot duplicate it, there is not much to
 lose.


 Indeed, anything is worth a shot at this point! I'll try that when I get a
chance and post back what I see.


IF YOU'RE REALLY BORED and want more context to the problem, you can check
out the free version of my app. From the main screen use the menu and select
Trek Tracker to open the second activity where the crash occurs. This
screen is series of drop downs for the user to drill down to the stop they
want bus predictions for.

The first option is the transit system - these are the hard-coded values in
the map: the strings the user sees are the keys, pulled directly from the
map, and they point to the derived type which handles the logic for getting
data for that system. All of these options are loaded in onCreate and pulled
directly from the map - if this part is working, that map should be
completely valid at this point.

Next the user selects a route, direction, and stop, each populated
dynamically based on the previous selection. Once the stop is selected,
that's all the data I need to get bus arrival predictions, so at this point
a thread is spawned with the users's selected data to load the predictions
every minute or so.

This is where the crash occurs. The background thread tries to use the
reference to the transit system it got from the very first selection, which
I swear should be valid at this point, and throws a NullPointerException. So
somehow, that reference which is EXPLICITLY set with map.put(Key, new
Derived()), ends up being null and then only in this activity.

Thanks for the continued help folks. This is a head-scratcher.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, 

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-30 Thread TreKing
On Mon, Aug 30, 2010 at 4:35 PM, Zsolt Vasvari zvasv...@gmail.com wrote:

 I downloaded the app, but I couldn't get it to crash, sorry.  But I did a
 clean install.


Thanks for trying! I can't believe I'm disappointed it didn't crash =P


 What a did notice, though, was how it only loaded the bus routes (from the
 web?) the first time around.  Even after I killed the app and relaunched it,
 the bus route list was populated without loading.  So you must be storing
 them locally, is that right?


Yes, all the data used on that screen is cached after the first access (in
the cached directory, 'natch) for faster retrieval later. It all comes from
the transit system in question, is out of my control, and has not changed.


 Not too sure what I am asking here, if you have the previous version of the
 app, I'd try to duplicate the problem by pushing the old version followed by
 the new one using adb, simulating an upgrade process.


I do have it (revision control FTW), good idea. I'll give that a go when I
get a chance. Thanks!

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-30 Thread Kostya Vasilyev
Since clearing application data in Android's application management screen
resolves the issue (as far as I understand from a previous message), perhaps
it would be worthwhile to try and understand what this data is, exactly, and
then follow the yellow brick road (so to speak) back to the code that
creates this data and uses it.

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

31.08.2010 1:44 пользователь TreKing treking...@gmail.com написал:

On Mon, Aug 30, 2010 at 4:35 PM, Zsolt Vasvari zvasv...@gmail.com wrote:

 I downloaded the app,...
Thanks for trying! I can't believe I'm disappointed it didn't crash =P




 What a did notice, though, was how it only loaded the bus routes (from the
web?) the first ti...
Yes, all the data used on that screen is cached after the first access (in
the cached directory, 'natch) for faster retrieval later. It all comes from
the transit system in question, is out of my control, and has not changed.




 Not too sure what I am asking here, if you have the previous version of
the app, I'd try to d...
I do have it (revision control FTW), good idea. I'll give that a go when I
get a chance. Thanks!

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices



-- 
You received this message because you are subscribed to the Google
Groups Android Developers...

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-30 Thread TreKing
PROBLEM SOLVED!

Conclusion: I'm an idiot (shocked!?)

So, for those of you that care, here was the problem. I followed Zsolt's
suggestion to go back to the previous version and then updated the app and
sure enough it crashed.

Quick background: The app gets data from the inter webs and then caches it
in my own format with some extra data for quicker access and to support
extra functionality. This cache is wiped on each update to refresh the
data and avoid issues exactly like this.

At least it's *supposed* to be wiped.

Unfortunately, while developing the latest version, I
apparently inadvertently removed the single line of code that clears the
cache when the app is updated! Genius!

So the new code was trying to load the old cache which was missing a new
piece of data (which it otherwise would get from that static map discussed
earlier).

I had no idea I'd removed that line to clear the cache so I didn't even
think it to be a possibility! I assumed all users were getting fresh data.

Well, now that I've thoroughly embarrassed myself, thank you all for your
time, sorry to have wasted it on such a stupid oversight, and Zsolt, you're
my hero for the brain-dead simple idea to try to update the app for
myself. I should really work that concept into my test plan ...

Now, if you'll excuse me, I have a proper update to release ...

Thanks everyone!

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-29 Thread TreKing
On Sat, Aug 28, 2010 at 3:22 AM, William Ferguson william.ferguson.au@
gmail.com wrote:

 From the symptoms, the code you posted and the assumption that this section
 of code is multi-threaded, it looks like a race condition.


That's for the suggestion, but where the static instance is used is indeed
in the main thread. The crash does occur in a separate thread, where the
variable that's supposed to be valid from that static data is used later,
but that thread is started long after the static instance is accessed (the
thread is dependent on the user's selections).

Though making it synchronized is probably a good idea regardless.

Something interesting I just realized - this same static class is used in
the main activity as part of loading the user's saved data and none of that
has any issues, which you think would given the clearing the data fixes the
problem.

So: Activity1 - Load user data using static data - No problems (at least
none reported)
Activity2, launched from Activity1, try to use any instance stored in the
static - crashy crashy.

On Sat, Aug 28, 2010 at 9:43 AM, Zsolt Vasvari zvasv...@gmail.com wrote:

 I think the install/reinstall and clearing the user data are red herrings.
  The app might work again for the user if they just ran it again.


I don't know. Every email I've gotten and all comments in the crash reports
indicate it's a consistent crash occurring 100% of the time (and in the
exact same location based on the ever-growing report count for the same
stack trace).

Clearing the data (or uninstalling / re-installing which clears the data as
well) makes the problem go away each and every time.

Thanks for the suggestions. I'm beyond baffled. I'm wishing it would start
crashing on me so I can start debugging the stupid thing!

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-29 Thread Dianne Hackborn
On Sun, Aug 29, 2010 at 6:24 PM, William Ferguson william.ferguson.au@
gmail.com wrote:

 Not real sure about this, just putting it out there ..
 But is is possible that Activity2 is started in a separate Task to
 Activity1?
 I can find any doco confirming or denying, but perhaps separate Tasks
 run in separate JVMs, hence the potential for non-initialization.
 What's the taskAffinity?


All activities in the same process have their callbacks called on the same
(main) thread of the process.  All activities in a .apk will run in the same
process, by default, unless you explicitly override their behavior with
android:process.  If you do that, those activities will run in the process
indicated, which has its own VM, statics, etc., completely isolated from
other processes.

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-27 Thread TreKing
On Thu, Aug 26, 2010 at 1:18 PM, TreKing treking...@gmail.com wrote:

 On Thu, Aug 26, 2010 at 12:42 PM, Dianne Hackborn hack...@android.comwrote:

 - See if having them clear data first before trying to uninstall solves
 the problem.


 I'll have someone try this next time I get an email and report back.


OK, so had two more emails yesterday and told them to clear their data by
going through the manage applications screen. I made no mention of
uninstalling and re-installing. One got back to me last night and confirmed
that this worked for her. I did not hear back from the other, which I assume
means she's happy and it worked for her as well.

So, apparently a complete uninstall is not necessary - there's something
wrong in the data. So now the question is what's going wrong in the app data
that would cause the app code to return null pointers on stuff that's not
relying on app data?

Side-note, after several more reports in the dev console and comments about
force close issues, I decided to put out another update instructing people
to uninstall - reinstall. This was, of course, just 10 minutes before the
nice lady got back to me and let me know clearing data worked.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-27 Thread TreKing
On Fri, Aug 27, 2010 at 10:01 AM, Carl Whalley
carl.whal...@googlemail.comwrote:

 Might be throwing in a food-for-thought curveball here but I wonder
 if there's a difference between updating an app that's running and one which
 isn't?


Might be. It's only a handful of people (well, more than a handful for me)
but still few in comparison to the total install base, so there's definitely
something they're doing that's triggering the problem.

I would think the update process would kill the app if it's running, but
maybe not.

Also, got confirmation from the second person that clearing the data solved
the problem.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-27 Thread Dianne Hackborn
Yes what happens during an update is the app is first force stopped (all
processes killed, alarms unregistered, etc), then then the new version is
installed.

It seems promising that clear data would fix the problem; this is most
likely then an issue you can deal with in your app rather than something
systemic.  The first thing I would look for is any code writing data that
could cause problems if it was killed in the middle of executing.  Databases
should handle this, but you need to deal with it yourself for raw files...
 for example SharedPreferences does this in its commit by writing the
contents into a new file, and then switching from the old file to the new
file once the new one is complete.

On Fri, Aug 27, 2010 at 10:53 AM, TreKing treking...@gmail.com wrote:

 On Fri, Aug 27, 2010 at 10:01 AM, Carl Whalley 
 carl.whal...@googlemail.com wrote:

 Might be throwing in a food-for-thought curveball here but I wonder
 if there's a difference between updating an app that's running and one which
 isn't?


 Might be. It's only a handful of people (well, more than a handful for me)
 but still few in comparison to the total install base, so there's definitely
 something they're doing that's triggering the problem.

 I would think the update process would kill the app if it's running, but
 maybe not.

 Also, got confirmation from the second person that clearing the data solved
 the problem.


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-27 Thread TreKing
Thanks for the continued help.

On Fri, Aug 27, 2010 at 2:22 PM, Dianne Hackborn hack...@android.comwrote:

  The first thing I would look for is any code writing data that could cause
 problems if it was killed in the middle of executing.


That makes sense, but that's also why I'm confused. The main issue I've had,
for which I have nearly 30 reports now in each version of my app in the dev
console, has nothing to do with data access. Unless I'm really missing
something.

I have a base class reference that should be set to the appropriate instance
of a derived class type based on user selection.
These derived type instances come from a manager class, of sorts, that holds
the instances. There is one static instance of this manager class in the app
since it's global, constant data. So it should be initialized, along with
it's internal data it manages, at all times. None of this involves any data
access.

Some pseudocode if it helps:

// In Manager class
public Manager
{
 private MapString, BaseRef refs = null;

 public Manager()
 {
  refs = new TreeMapString, BaseRef();

  // Explicitly add derived instances of BaseRef
  refs.put(Key, new DerivedInstance());

  // add more ...
 }

 public BaseRef get(String key)
 {
  return refs.get(key);
 }
}

//In Static access class
public StaticClass
{
 private static Manager manager = new Manager();

 public static Manager getManager() { return manager; }
}

// Then, finally, in the class where the crash occurs
BaseRef baseRef = StaticClass.getManager().get(userSelection);


Userselection is the value chosen by the user from a list pre-populated by
the Keys in the Manager class to begin with.
So if the user was able to make the selection, the key was there at the
start of the Activity, and in the manager where it originated from.

baseRef, which is obtained from that single manager's list (which is
essentially hard-coded), is later used elsewhere and ends up being null.

There is no file data access involved anywhere in this Activity besides
using SharedPreferences for exactly one option.

Also, now that I've typed this out, this goes against the idea that statics
are the problem since I would have had the null pointer at the point where I
try to access the Manager class. Instead, it appears to be valid but for
some reason its internal data, which is set on construction, is not.

It's worth noting that I've seen this problem to a lesser extent before I
added this manager class stuff, but since adding it last week, the problem
seems to have exploded with a fury. But again, not sure if that's a result
of a larger user-base over two months since last major update.

I think at some point I'll start polling my users to see how many of them
continue to see the issue after updating. Since I've instructed them, in
nice big letters, to try uninstalling first, I expect not to hear any more
complaints for now, but I'd rather fix the problem than band-aid it like
this.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-27 Thread Tom Gibara
I wasn't able to fully follow your description, but this bit caught me eye:

Userselection is the value chosen by the user from a list pre-populated by
 the Keys in the Manager class to begin with. So if the user was able to make
 the selection, the key was there at the start of the Activity, and in the
 manager where it originated from.


Have the keys changed between releases of the application? Is the selected
key persisted in any way?

Tom.


On 27 August 2010 21:40, TreKing treking...@gmail.com wrote:

 Thanks for the continued help.

 On Fri, Aug 27, 2010 at 2:22 PM, Dianne Hackborn hack...@android.comwrote:

  The first thing I would look for is any code writing data that could
 cause problems if it was killed in the middle of executing.


 That makes sense, but that's also why I'm confused. The main issue I've
 had, for which I have nearly 30 reports now in each version of my app in the
 dev console, has nothing to do with data access. Unless I'm really missing
 something.

 I have a base class reference that should be set to the appropriate
 instance of a derived class type based on user selection.
 These derived type instances come from a manager class, of sorts, that
 holds the instances. There is one static instance of this manager class in
 the app since it's global, constant data. So it should be initialized, along
 with it's internal data it manages, at all times. None of this involves any
 data access.

 Some pseudocode if it helps:

 // In Manager class
 public Manager
 {
  private MapString, BaseRef refs = null;

  public Manager()
  {
   refs = new TreeMapString, BaseRef();

   // Explicitly add derived instances of BaseRef
   refs.put(Key, new DerivedInstance());

   // add more ...
  }

  public BaseRef get(String key)
  {
   return refs.get(key);
  }
 }

 //In Static access class
 public StaticClass
 {
  private static Manager manager = new Manager();

  public static Manager getManager() { return manager; }
 }

 // Then, finally, in the class where the crash occurs
 BaseRef baseRef = StaticClass.getManager().get(userSelection);


 Userselection is the value chosen by the user from a list pre-populated
 by the Keys in the Manager class to begin with.
 So if the user was able to make the selection, the key was there at the
 start of the Activity, and in the manager where it originated from.

 baseRef, which is obtained from that single manager's list (which is
 essentially hard-coded), is later used elsewhere and ends up being null.

 There is no file data access involved anywhere in this Activity besides
 using SharedPreferences for exactly one option.

 Also, now that I've typed this out, this goes against the idea that statics
 are the problem since I would have had the null pointer at the point where I
 try to access the Manager class. Instead, it appears to be valid but for
 some reason its internal data, which is set on construction, is not.

 It's worth noting that I've seen this problem to a lesser extent before I
 added this manager class stuff, but since adding it last week, the problem
 seems to have exploded with a fury. But again, not sure if that's a result
 of a larger user-base over two months since last major update.

 I think at some point I'll start polling my users to see how many of them
 continue to see the issue after updating. Since I've instructed them, in
 nice big letters, to try uninstalling first, I expect not to hear any more
 complaints for now, but I'd rather fix the problem than band-aid it like
 this.


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-27 Thread TreKing
On Fri, Aug 27, 2010 at 3:53 PM, Tom Gibara tomgib...@gmail.com wrote:

 Have the keys changed between releases of the application? Is the selected
 key persisted in any way?


Nope, they're hard-coded and were introduced in the last update.
So where I have Key is a string literal I use to ID the derived instance.

So it's like:

refs.add(Option1, new Derived1());
refs.add(Option1, new Derived2());

and so on.

Then in a drop down, the user can select Option1 or Option2, each option
being obtained from the hard-coded list.
So yeah, no saving or restoring of the keys. All in the code.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-26 Thread TreKing
On Thu, Aug 26, 2010 at 3:31 AM, mot12 martin.hu...@gmail.com wrote:

 The problem with null pointers I can also see with my users.


I now have 19 more reports of the same problem in the Dev Console for the
free version and 16 for the paid version. Same stack trace, same
NullPointerException.


 I don't understand the above comment about statics either.
 Uninstalling the app presumably means that app being closed first. The
 updated version needs to be started by the user, it doesn't
 automatically replace what was in memory before.


Agreed, especially since users report the issue continues after a phone
reboot. Re-install is the only solution.

But it may be related to static data somehow. The null pointer people are
reporting is supposed to be set from a static list of predefined objects and
I just added this new static data in the last release, which probably
explains the surge in problems since last time. It's like the new static
data is being corrupted somehow.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-26 Thread TreKing
On Thu, Aug 26, 2010 at 8:17 AM, mot12 martin.hu...@gmail.com wrote:

 If you think this is due to some specific code changes you just made, you
 could of course have messed up. But I am sure you checked that.


Oh no, I don't think it's my code that's wrong, otherwise EVERYONE would be
complaining and reinstalling would not help. I just think the changes I made
have exacerbated the underlying problem in the update process.


 I wonder what uninstalling does that a simple update doesn't accomplish.


That's the key question. I wish I knew what the update process did in
detail. Any idea if it's in the Android source? I haven't looked, but I'll
check later when I get a chance (unless someone knows for sure either way
and can save me some time).


 I will google this a bit and see if I can find anything out.


Good luck. I've had no luck so far.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-26 Thread Dianne Hackborn
Some things to try:

- See if having them clear data first before trying to uninstall solves the
problem.
- For users with apps on SD card support, they could try moving to the SD
card and back.
- Look in the logcat output to see if there are any suspicious messages from
installing (logcat output should be included in bug reports in the dev
console).
- Look for a user with the dev tools installed to get the output of adb
shell dumpsys package.  This will have some information about how your app
is currently installed.

On Thu, Aug 26, 2010 at 6:25 AM, TreKing treking...@gmail.com wrote:

 On Thu, Aug 26, 2010 at 8:17 AM, mot12 martin.hu...@gmail.com wrote:

 If you think this is due to some specific code changes you just made, you
 could of course have messed up. But I am sure you checked that.


 Oh no, I don't think it's my code that's wrong, otherwise EVERYONE would be
 complaining and reinstalling would not help. I just think the changes I made
 have exacerbated the underlying problem in the update process.


 I wonder what uninstalling does that a simple update doesn't accomplish.


 That's the key question. I wish I knew what the update process did in
 detail. Any idea if it's in the Android source? I haven't looked, but I'll
 check later when I get a chance (unless someone knows for sure either way
 and can save me some time).


 I will google this a bit and see if I can find anything out.


 Good luck. I've had no luck so far.


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-26 Thread TreKing
On Thu, Aug 26, 2010 at 12:42 PM, Dianne Hackborn hack...@android.comwrote:

 - See if having them clear data first before trying to uninstall solves the
 problem.


I'll have someone try this next time I get an email and report back.


 - For users with apps on SD card support, they could try moving to the SD
 card and back.


I haven't enabled this for my apps and really don't want to. Maybe someone
else can see if this helps?


 - Look in the logcat output to see if there are any suspicious messages
 from installing (logcat output should be included in bug reports in the dev
 console).


I've never gotten logcat output in the dev console. I don't know if the
users can opt not to send it, or if I'm just seeing it, or if it's just not
available.

Any idea if this is an option for users to send or where in the console it's
supposed to show up?


 - Look for a user with the dev tools installed to get the output of adb
 shell dumpsys package.  This will have some information about how your app
 is currently installed.


Now that will be tricky ...


Thanks for all suggestions!

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-26 Thread TreKing
On Thu, Aug 26, 2010 at 1:56 PM, Doug beafd...@gmail.com wrote:

 I don't have anything helpful to add, TreKing, but I did want you to know
 that a small minority of my users see random breakage on update and a
 reinstall fixes them right up.


Just knowing others are having the same issue is helpful. With
enough anecdotes we can begin to pinpoint commonalities and
hopefully unearth the root cause of the problem. If anyone else has had this
issue, please share any details you may have.
Thanks.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-26 Thread Dianne Hackborn
On Thu, Aug 26, 2010 at 11:18 AM, TreKing treking...@gmail.com wrote:

  - Look in the logcat output to see if there are any suspicious messages
 from installing (logcat output should be included in bug reports in the dev
 console).


 I've never gotten logcat output in the dev console. I don't know if the
 users can opt not to send it, or if I'm just seeing it, or if it's just not
 available.
 Any idea if this is an option for users to send or where in the console
 it's supposed to show up?


Ah, you are right, I didn't realize it wasn't available in the console
though it is part of the data the user uploads.  I suspect this is for
privacy reasons (we have seen lots of apps printing stuff to the log that
they shouldn't), though don't know for sure.  If it isn't there in the
console, I don't think there is a way to get to it.


 - Look for a user with the dev tools installed to get the output of adb
 shell dumpsys package.  This will have some information about how your app
 is currently installed.

 Now that will be tricky ...


Yeah. :/

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-26 Thread Dianne Hackborn
Hm the class files aren't really unpacked on disk.  They exist as a single
.dex file in the .apk.  During install, a .odex file is created on disk --
this is the .dex file linked to the current platform code.  When the VM
loads your .apk, if the signature on the .dex inside doesn't match the .odex
on disk it will try to re-create the one on disk...  which will fail in a
very clear way since normal apps doesn't have permission to write to the
directory where they are stored.

On Thu, Aug 26, 2010 at 4:55 PM, William Ferguson william.ferguson.au@
gmail.com wrote:

 Since it continues to occur after reboot it means there is a problem
 with the the way the class files have been unpacked to disk.

 When an apk is installed and that app already exists, a temp folder
 for the new instal is created, z and presumably the old instal is
 removed later.

 It sounds like in some cases the new instal is being overlaid on the
 existing app. Perhaps davlik segments static initialzers into separate
 files and that's why you're seeing these symptoms.

 On Aug 26, 10:59 pm, TreKing treking...@gmail.com wrote:
  On Thu, Aug 26, 2010 at 3:31 AM, mot12 martin.hu...@gmail.com wrote:
   The problem with null pointers I can also see with my users.
 
  I now have 19 more reports of the same problem in the Dev Console for the
  free version and 16 for the paid version. Same stack trace, same
  NullPointerException.
 
   I don't understand the above comment about statics either.
   Uninstalling the app presumably means that app being closed first. The
   updated version needs to be started by the user, it doesn't
   automatically replace what was in memory before.
 
  Agreed, especially since users report the issue continues after a phone
  reboot. Re-install is the only solution.
 
  But it may be related to static data somehow. The null pointer people are
  reporting is supposed to be set from a static list of predefined objects
 and
  I just added this new static data in the last release, which probably
  explains the surge in problems since last time. It's like the new static
  data is being corrupted somehow.
 
 
 ---
 --
  TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
  transit tracking app for Android-powered devices

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-25 Thread TreKing
On Wed, Aug 25, 2010 at 1:48 AM, Pent tas...@dinglisch.net wrote:

 Update clears your statics, so you might expect extra bugs to come up
 around that time I guess e.g. if they're not reinitialized properly.


Could you elaborate on this? I do use statics for storing user data and
looking at some of the reported bugs, it's certainly possible the null
pointers could have been initialized from that static data at some point,
but I don't see how this static data would be uninitialized.

If you're updating, I'd expect the current version of the app to be closed /
shut down and your static data to be wiped, for sure, and re-initialized on
re-opening. Or am I missing something regarding Java statics or the Android
update process?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-25 Thread TreKing
On Wed, Aug 25, 2010 at 8:55 AM, Yahel kaye...@gmail.com wrote:

 I'm not sure but if you have really few of these, they might just come from
 illegal/torrent-style installs ? Someone tried to install the app on there
 non-gps device or something ?


I thought so, but isn't the installation of an apps supposed to fail if the
required library is not present?

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-25 Thread Justin Giles
I've experienced users having crashing problem after an update.  I'm not
sure if yours is device specific, but I would say almost 99% of the crash
reports after updating are from Motorola Droid users (via email and console
error reporting).  This could mean that a large majority of my user base is
using Droids, but I find it very strange that that seems to be the only
device I get complaints like this from.  Most of the crashing is due to
sqlite databases that get corrupted after an update.  I do have error
checking code to check for such things, but when I think I have it fixed, it
crops up again on the next updates.  Very frustrating.


On Wed, Aug 25, 2010 at 9:00 AM, TreKing treking...@gmail.com wrote:

 On Wed, Aug 25, 2010 at 8:55 AM, Yahel kaye...@gmail.com wrote:

 I'm not sure but if you have really few of these, they might just
 come from illegal/torrent-style installs ? Someone tried to install the
 app on there non-gps device or something ?


 I thought so, but isn't the installation of an apps supposed to fail if the
 required library is not present?


 -
 TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
 transit tracking app for Android-powered devices

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-25 Thread TreKing
On Wed, Aug 25, 2010 at 9:42 AM, Justin Giles jtgi...@gmail.com wrote:

 I'm not sure if yours is device specific, but I would say almost 99% of the
 crash reports after updating are from Motorola Droid users (via email and
 console error reporting).


Most of the console reports are indeed Droids, though that's probably due to
the popularity of that device and the fact that it's one of the few that has
the report issue capability (I think).


   Very frustrating.


Indeed.

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-25 Thread TreKing
On Wed, Aug 25, 2010 at 10:06 AM, Yahel kaye...@gmail.com wrote:

 Maybe not if it is not install through the market but directly launched
 using a file manager after the where-ever-it-came-from download.


Could be wrong, but don't think the installer matters. For example, if you
make an AVD with no maps and try to install, you get the missing shared
library error.

On Wed, Aug 25, 2010 at 10:10 AM, Yahel kaye...@gmail.com wrote:

 I've just noticed after reading your post : Go check out the app
 called guitar solo.

 Try to ask him what is experience is.


Nice find. I'll email him / her / them and see if they want to chime in to
the discussion, thanks!

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-25 Thread TreKing
On Wed, Aug 25, 2010 at 1:37 PM, Pent tas...@dinglisch.net wrote:

 Yes, e.g. if function (a) relies on statics (s), so you only
 initialize (s) if (a)
 is being used (set by prefs). Later you add function (b) which also
 uses (s).
 When the pref controlling (a) is disabled, everything works fine until
 the next statics
 reset when (b) starts crashing.


I'm sorry, but I didn't follow any of that ...

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: App breaks for some users after they update from the Market

2010-08-25 Thread TreKing
On Wed, Aug 25, 2010 at 3:56 PM, Nyll codingcave...@gmail.com wrote:

 As far as I know, this is related to copy protection and a bug in devices
 running Android 1.5.


Hey, thanks for the info. Unfortunately, I don't think it's my problem.

I've never used copy protection and have gotten reports from multiple
devices, primarily Droids which are definitely not 1.5.

Meanwhile I've gotten three more bug reports through my site (Two
Incredibles and a MyTouch) and one comment on the Market from a Hero user.

This is going to be a long week ...


 (As an aside, it is probably not wise to cheese of the Google devs on a
 forum where you are asking for their help :)


Yeah, lesson learned =P Wonder what I can do to make it up ...

-
TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en