Troubles updating from Mapsforge 0.4.3 to 0.5.0-rc1 in Android

345 views
Skip to first unread message

dolphinziyo yo

unread,
Feb 25, 2015, 4:26:47 PM2/25/15
to mapsfo...@googlegroups.com
Hi, I have a working app with mapsforge version 0.4.3 in Android and I would like to update the library to the version 0.5.0 but Gradle (ProGuard) shows me some warnings and doesn't compile. Here are the warnings:

Note: there were 16 duplicate class definitions.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning: com.caverock.androidsvg.SVGImageView: can't find referenced class com.caverock.androidsvg.R$styleable
Warning: com.caverock.androidsvg.SVGImageView: can't find referenced class com.caverock.androidsvg.R$styleable
Warning: com.caverock.androidsvg.SVGImageView: can't find referenced class com.caverock.androidsvg.R
Warning: there were 3 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:app:proguardDebug FAILED

I know I can avoid these warnings but I prefer to solve them if I can.
My build.gradle file contains this lines talking about mapsforge (I only changed the number version):

    compile 'org.mapsforge:mapsforge-core:0.5.0-rc1'
    compile 'org.mapsforge:mapsforge-map-reader:0.5.0-rc1'
    compile 'org.mapsforge:mapsforge-map:0.5.0-rc1'
    compile 'org.mapsforge:mapsforge-map-android:0.5.0-rc1'
    compile 'org.mapsforge:svg-android:0.4.3'

I was looking in the docs and the forum but I didn't find anything like this so I would be so grateful if someone could help me.
Thank you very much.

Ludwig

unread,
Feb 25, 2015, 4:30:54 PM2/25/15
to mapsfo...@googlegroups.com

First of all there is no point upgrading to 0.5.0_rc1. Use the final 0.5.0 release instead.
Secondly, I think you are simply missing the svg library we were using.

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapsforge-dev/2b625b7d-7e15-4b6a-b51c-d66b343c320e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dolphinziyo yo

unread,
Feb 25, 2015, 4:54:53 PM2/25/15
to mapsfo...@googlegroups.com
Hi Ludwig, I had with 0.5.0 instead of 0.5.0-rc1 and had the same problems so I tried changing it, but I'm going to change it again.
In Gradle I have the SVG library added as you can see in the line:

compile 'org.mapsforge:svg-android:0.4.3'

Must I add another library different than this? I have been searching and there isn't a 0.5.0 version of this SVG library

Ludwig

unread,
Feb 25, 2015, 5:01:12 PM2/25/15
to mapsfo...@googlegroups.com

No for 0.5 we are using an external library. I am away from computer best look in samples app what is linked in.

dolphinziyo yo

unread,
Feb 25, 2015, 5:34:09 PM2/25/15
to mapsfo...@googlegroups.com
Ok don't worry, I will look the samples, thank you very much Ludwig!¡

dolphinziyo yo

unread,
Feb 25, 2015, 6:42:42 PM2/25/15
to mapsfo...@googlegroups.com
Hi again, I was looking the samples and I found that the new library is the AndroidSVG library so I added it to Gradle but the error keeps showing. Now my Gradle is:
    compile 'com.caverock:androidsvg:1.2.1'
    compile 'org.mapsforge:mapsforge-core:0.5.0'
    compile 'org.mapsforge:mapsforge-map:0.5.0'
    compile 'org.mapsforge:mapsforge-map-reader:0.5.0'
    compile 'org.mapsforge:mapsforge-map-android:0.5.0'
Temporarily I set the "-dontwarn" parameter to ProGuard in order to compile the app until I find the correct way to solve this issue.
Thank you again.

Ludwig

unread,
Feb 25, 2015, 6:46:21 PM2/25/15
to mapsfo...@googlegroups.com
I think if you look at the Samples app, the only dependency is 

dependencies {

  compile project(":mapsforge-map-android")

 }

which then pulls in the other stuff I guess.

I remember having trouble getting these dependencies to work in a project independent of mapsforge, so when you get this solved, let us know please.

Ludwig



Emux

unread,
Feb 26, 2015, 2:29:11 AM2/26/15
to mapsfo...@googlegroups.com
The easiest way to handle *jar libraries* in Gradle is with the way I describe here.

--
Emux
Cruiser - Atlas

dolphinziyo yo

unread,
Feb 26, 2015, 7:02:32 AM2/26/15
to mapsfo...@googlegroups.com
Setting only the " compile 'org.mapsforge:mapsforge-map-android:0.5.0' " line the build fails with the same warnings.

dolphinziyo yo

unread,
Feb 26, 2015, 7:11:04 AM2/26/15
to mapsfo...@googlegroups.com
So, can't I manage the mapsforge dependencies with Gradle? I prefer doing it this way, it's easier and more efficient. Actually, I don't mind to add a "-dontwarn" paremeter to ProGuard if it is needed but I think it would be great If we didn't have to do this.

Ludwig

unread,
Feb 26, 2015, 7:18:00 AM2/26/15
to mapsfo...@googlegroups.com

Certain things are more gradle issues and of your project setup, there is nothing wrong with the jars we provide (they work for others including me without issues), but everyone has their environment setup a bit different and finding the differences is tricky.

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.

Emux

unread,
Feb 26, 2015, 7:18:21 AM2/26/15
to mapsfo...@googlegroups.com
On 26/02/2015 02:11 μμ, dolphinziyo yo wrote:
So, can't I manage the mapsforge dependencies with Gradle? I prefer doing it this way, it's easier and more efficient.

I agree that of course we should be able to do it.
But I'm sorry not having an easy answer right now..

dolphinziyo yo

unread,
Feb 26, 2015, 4:33:06 PM2/26/15
to mapsfo...@googlegroups.com
Thank you both, Emux and Ludwig, it can be an specific problem of my project, so until I can do more research I will keep the Proguard parameter to avoid the warnings of the AndroidSVG library.
Thank you very much.

Emux

unread,
Feb 26, 2015, 4:54:00 PM2/26/15
to mapsfo...@googlegroups.com
It's safe to use in Proguard rules (as we just want the rendering) :

-dontwarn com.caverock.androidsvg.SVGImageView

dolphinziyo yo

unread,
Feb 26, 2015, 6:37:25 PM2/26/15
to mapsfo...@googlegroups.com
Yes, that is the rule I'm using in the "proguard-rules.pro" file.
Reply all
Reply to author
Forward
0 new messages