jgilfelt/android-mapviewballoons — Issue #16: onBalloonTap does not work if I build with ProGuard
Author: MarKco
Created: 2012-02-09 08:54:37+00:00
State: open

I'm developing a project using android-mapviewballoons. I extended com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay with a customized class called CustomItemizedOverlay and in this class I redefined onBalloonTap(int index).

When I build a signed APK without using proguard everything works fine: the application runs, I can tap on the map, see the Balloon, tap on the balloon and, via onBalloonTap, get further information about the point I've been tapping on. When I build with proguard active the application runs flawlessly except for the balloon: I can tap on the map, see the balloon but when I click on it nothing happens. It's just as the balloon itself was transparent, if there's something behind it it gets selected, just as the balloon was not there.

I tried removing features from proguard.cfg one by one, but couldn't find what's happening. I tried with -dontoptimize but didn't work. I think that maybe the issue comes from the obfuscation process, but I can't avoid obfuscation because if I put the -dontobfuscate directive building fails with a "Dalvik Error 1" message.

In the "library" section of my proguard file I have: (...)
-libraryjars /home/marco/workspace/../Scrivania/android-sdk-linux/add-ons/addon-google_apis-google_inc_-7/libs/maps.jar

-libraryjars /home/marco/workspace/android-mapviewballoons/bin/android-mapviewballoons.jar

In the "keep" section I have (among others):
-keep public class * extends com.google.android.maps.MapActivity

-keep class com.posteitaliane.postemobile.CoverFlow

-keepclassmembers public class com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay.** {
public static * ;
}

-keepclassmembers public class com.posteitaliane.postemobile.CustomItemizedOverlay.** {
public static * ;
}

-keepclassmembers public class com.readystatesoftware.mapviewballoons.** {
public static * ;
}

Could somebody please help me? I just don't know how to create a signed build without breaking proguard or losing this mapBalloon feature.

Thank you in advance