code.neenbedankt.com

 

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 :)

Filed under  //   android  

Comments [1]

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.

Filed under  //   android   rainy days  

Comments [0]

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.

Filed under  //   android   development  

Comments [0]

Outage

This night (in my timezone) something went seriously wrong with the server that I use for Rainy Days. The result was that "network error" was displayed. I've fixed this now and all should be returning to normal within a couple of hours.

If you still are experiencing network errors after that, please let me know.

Comments [2]

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!

Filed under  //   android   rainy days  

Comments [9]

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

Filed under  //   android   rainy days  

Comments [0]

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.

 

Filed under  //   android   rainy days  

Comments [2]

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!

Filed under  //   android   budget coach  

Comments [0]

Unquoted paths with Nginx and Trac

This took me ages to find so I'd better document it here. When switching to nginx from lighttpd I ran into some problems with the trac instance that was running through fcgi. After following most of the tutorials around to set it up, all looked fine. Then I ran into issue 9755.

To solve it I first tried to go the proxy-standalone-trac route, which has an unquote option to cope with this issue. But in that case my authentication through nginx would never work. In the end I went digging in the trac source code and found the FlupMiddleware class that is used when running in "unquote" mode for tracd. After some more digging I found that in Trac 0.12.2 this is integrated in the fcgi_frontend.py script that is distributed with Trac. 

So here it comes...To activate the unquoting just set the environment variable TRAC_USE_FLUP to true (actually anything but 0, no or false will do) and we're golden.

Hope that 'll save you some hours, like I wasted mine :)

Filed under  //   nginx   trac   troubleshooting  

Comments [0]

Small Rainy Days update: 2.0.1

After my previous post I did some bug hunting, and I got a response from a few users. With this info I have implemented (what I hope) a workaround for the slowness on Droid Eris.

I also fixed the few bugs that where reported through the automated Android error reporting so Rainy Days should be a little bit more stable now.

One thing that I can't stress enough is this: if you experience issues with the app, and you want those issues to be fixed, please, pretty please (sugar on top) contact me! Without any details I'm pretty much blind, which is frustrating to say the least :)

I hope you all enjoy the update! 

Comments [2]