Import mapsforge in an Android project using gradle

1,063 views
Skip to first unread message

Jones

unread,
Jun 29, 2014, 10:01:59 AM6/29/14
to mapsfo...@googlegroups.com
Hi,

I am new to mapsforge, and I wanted to build the simple HelloWorld sample that I found on the wiki. I first included mapsforge-android to my build.gradle with the following line:

compile 'org.mapsforge:mapsforge-map-android:0.4.3'
  
But then, I simply cannot import MapActivity as described in the wiki:

import org.mapsforge.android.maps.MapActivity;

In my project, I actually have org.mapsforge.map.android, and it does not contain MapActivity (but it contains MapView, for instance). Why is it the case? Am I using an old version? Or should I not link mapsforge this way?

Best Regards

Emux

unread,
Jun 29, 2014, 10:13:43 AM6/29/14
to mapsfo...@googlegroups.com
What Wiki is that, probably an old one?
The MapActivity class existed at previous Mapsforge 0.3.X at latest release 0.4 it's not used anymore.

The Wiki with a simple Android app is the GettingStartedAndroidApp.
And you can find more advanced examples at Samples app.

--
Emux
Cruiser - Atlas

Ludwig

unread,
Jun 29, 2014, 10:34:53 AM6/29/14
to mapsfo...@googlegroups.com

The easiest way is probably to place your project alongside the samples project and just add it to the top level build.gradle and settings.gradle.
I know this is not great for keeping projects apart but gradle does not seem to like importing from another project tree.

--
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/53B01F12.4060400%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Jones

unread,
Jul 1, 2014, 4:58:19 PM7/1/14
to mapsfo...@googlegroups.com
Thanks for the fast answers! I was using an outdated tutorial indeed.

Just because I like to have a working sample project when I work on a new project, I created a repository here: https://github.com/JonasVautherin/MapsforgeGettingStarted. It is using gradle and the gradle wrapper, so that it should be really easy to compile it. I thought it might be helpful to share the link.

Regards
Reply all
Reply to author
Forward
0 new messages