2

I published app recently on google play store, after i published the app i checked the code again and i saw that there is try-catch block like this:

try {
    // .... do something
} catch (Exception e) {
    // ... do something to handle the error
    e.printStackTrace();
}

so i forgot this statement: e.printStackTrace();

I wonder wether this Can affect anything after google accept this app and it is alive on store?

Should I remove them and republish it again?

MBH
  • 16,271
  • 19
  • 99
  • 149
  • 1
    @Boss the `e.printStackTrace();` doesn't do that. And generally a caught exception doesn't either, especially not when it's handled as stated in `// ... do something to handle the error` – Daniël van den Berg Oct 09 '15 at 06:03

3 Answers3

1

It should just report the issue. Most people won't understand, but I don't think it'll have much of a negative impact. I'd rather have an error message I don't get than just a crash. You should be alright.

Syllith
  • 189
  • 10
  • I handled that error, i show error message in the catch block just right before the **e.printStackTrace();** statement – MBH Oct 09 '15 at 06:05
1

It will write the stack trace into the log. Nothing to worry about.

Henry
  • 42,982
  • 7
  • 68
  • 84
1

This does have some effect, in terms of performance loss. It'll still write the log to the LogCat, but normal users won't do anything with it, nor see it. Also, this performance loss is negligible.

As for other log messages, you might be interested in looking at Remove all debug logging calls before publishing: are there tools to do this?. In there, this part of code is mentioned:

if (BuildConfig.DEBUG) {

If you place that around the e.printStackTrace(), it will get removed entirely from the app when you change your BuildConfig to RELEASE. (Do note, release VS debug does have significant effects, so do make sure you published in release mode.)

As for your last question,

Should I remove them and republish it again?

Consider this. Either have an app that runs 0.1 millisecond slower, or have to update an app with no notable changes. Which would you, as an user, prefer?

Community
  • 1
  • 1
Daniël van den Berg
  • 2,197
  • 1
  • 20
  • 45
  • +1 for the `if (BuildConfig.DEBUG) {}`. And thanks for the great answer. Actually, most of `e.printStackTrace()` statements are not on the mainThread. they are on another threads. So that, they will have no noticeable performance effect. The most important thing to me that it wont cause any crash to the app. – MBH Oct 09 '15 at 06:18