55 articles Tag android

Be aware of ProGuard optimizations on Android apps

Yesterday I released Rainy Days to celebrate passing the 400k downloads. Soon after, my celebration was partycrashed when a few users reported that Rainy Days wouldn’t open on their phone. First I was clueless, especially because I either couldn’t reach those users or couldn’t get a logcat from them showing me the error. The only thing I had to debug was their Android OS version and screen size basically. So I fired up some emulators and tested various configuration again, this is something I do before every release in fact. I couldn’t reproduce the bug.

Then I got one other email. Again, a user on 1.5 which couldn’t launch the app. So this time I took the released apk, put it on the emulator, and sure enough: it crashed on open. Actually it crashed with a verify error, meaning that a class is referencing methods that don’t exist on that platform.

When it runs fine from Eclipse on 1.5, but the released version doesn’t it, what is the difference? The released version was run through Proguard to obfuscate the code. But Proguard does not only obfuscate, but also optimize your code and it does a pretty good job at it.

Unfortunately it had this time inlined the class I use for compatiblity code which caused the verify error. The code I took great care to separate out to make sure it wouldn’t be called on older platforms was now inlined in my main activity. Auch.

So the lessons learned are these: be aware of optimization and test the release apk on the emulator. Proguard is a powerful tool and with great power comes great responsibility :)

Rainy Days 2.2.3

Rainy Days just passed the 400.000 downloads mark, amazing! To celebrate, here’s a little update that improves performance and fixes some bugs.

New in this version is that you can move the map when the animation is paused. To do that use two fingers to pan the map. Because this uses multitouch it will not work on all phones and may not work that well on some other phones which have limited multitouch support.

If you already have the app installed, the market should notify you soon of an update. If you don’t have Rainy Days, check it out in the market!

Edit: 2.2.3 unfortunately broke 1.5 & 1.6 support, which is fixed now in 2.2.4.

Android Logging

Logging in any type of software is a useful tool to debug and improve your software. Typically you’ll have different types of stuff you want to log: errors, information, traceing etc. So most logging systems have a concept of levels that allow you to specify how important a message is, so that at a later time you can enable a certain type of logging to inspect.

In Android it is handled by the Log class. It too allows for runtime configuration of loggers and it involves setting Android system properties using the setprop command, which is nice if you are building an app as part of the OS but maybe overkill or even clunky if you just want to create your next great app. And what if you don’t want your shipping app to have any logging whatsoever? You certainly want it during development, trust me :) Well enter this little utility class:


package com.neenbedankt.rainydays.util;
public class Logging {
    public static final boolean LOGV = true;
    public static final boolean LOGD = false || LOGV;
    public static final boolean LOGI = false || LOGD;
    public static final boolean LOGW = false || LOGI;
    public static final boolean LOGE = false || LOGW;
}
 
What this does is setting some flags that indicate what level of logging you want. If you want all logging, just set LOGV to true. If you only want the “info” level and up just enable info. Easy! Now you still have to reference this from your code like this:


// you can also use a static import to drop the Logging part...
if (Logging.LOGD) {
 Log.d(TAG, 'This is my debug statement');
}

Tip: you can setup an Eclipse template to generate these kinds of code blocks very fast.

Now the beauty of this all is that since the LOGD variable is a static final (a constant) the compiler will strip out the entire if statement if the LOGD variable is false, hence no logging in your final app and no bytecode generated for it either.

So by introducing a simple class and wrapping the log statements in an if block you’ll still be able to enable particular levels of logging, while in your shipping product the logging is stripped out.

Rainy Days 2.2.1

I just pushed out Rainy Days 2.2.1 that fixes some important bugs. On slow connections Rainy Days would sometimes crash or hang. I’ve now fixed this so get the new version!

More updates

I’ve just released Rainy Days 2.2, a small update to fix some crashes that are reported. Also not all of you liked the on-screen legenda, so it can now be switched off from the settings.

I also like to thank all of you who support Rainy Days by buying the upgrade or just telling me how much you like the app! Really amazing!

Hugo

Rainy Days 2.1

Here it is, a new update to Rainy Days, still going strong :) In 2.1 I’ve added a couple of features:

  • On screen legenda, ranging from light to heavy precipitation (yes, finally!)
  • You can now search for a location, using the search key or the search option from the menu. This also allows for a lightweight form of bookmarking places, as your searches are remembered.
  • As for coverage, Guam was added.
  • For developers, you can now start Rainy Days with a desired location using an intent. Contact me for details if you want ’em.

Under the hood lots has been changed again to improve stability and make it possible to add new cool features which I’m working on.

Another change that I’m making is that Rainy Days will be ad supported as of today. The main reason for is simple: Rainy Days is costing me money. How much depends on the actual use of Rainy Days, but since the app gets more and more popular, the costs will rise and I need a way to at least partially cover those costs. In the past I’ve received some donations through paypal and the donation app, but while they are very much appreciated, the current rate of donations isn’t enough to be sort of sustainable. Thanks again to all of you who have donated!

For those of you who don’t want to see ads, there’s the option to upgrade from within the app for a small fee, which will disable the ads on all your devices forever. The next two weeks I’ll price the upgrade at only $0.99 cents. Sorry, I can not auto-upgrade those who have previously donated due to technical reasons, I hope you understand. Feel free to contact me for further details.

I hope you’ll like the new features! You can get the updated Rainy Days app from the Android market.

 

New app released: Budget Coach

At Qbus we build great web applications and mobile apps. Just now we have released a new app: Budget Coach. Budget Coach is an app that helps you tracking your budget in a easy and simple way.

For this app we worked together with Nong Sudson at http://www.plasmastudio.nl/, who developed the concept and the design of the app. Check out some of screenshots and download it from the Android market today for free!

Rainy Days testers wanted

I’m looking for testers for the upcoming 2.0 version of Rainy Days. If you like to help me test it, please drop me an email! You can find the address in the Android market. (Yes, consider that a test :))

Update: Thanks to everybody who has helped me test 2.0! I’ve just released the new version.

Rainy Days radar clutter

Currently US radar coverage is filtered a bit more in an attempt to reduce radar clutter. Please let me know if you think this is an improvement or not. Obviously I can’t go over there and check for myself :)

Rainy Days update

While I’m still working on the next version of Rainy Days, I just pushed out an update for Rainy Days 1.9.
On some devices the settings screen could not be accessed and I’ve fixed this in 1.9.1, with the help of Karl Pearson, who was so kind to report the bug and test the fix.

For several reasons work on Rainy Days 2.0 has been a bit delayed, but I’m making progress, more on that in the couple of weeks!

Update: I noticed some crash reports in the Market console which I have fixed in 1.9.2…and that broke other stuff, so now 1.9.3 is out :)