opensciencemap / vtm

a vector-tile map library written in java - running on android, desktop and within the browser
GNU Lesser General Public License v3.0
238 stars 176 forks source link

Adding openscienemap as a library to existing project #126

Open AAverin opened 9 years ago

AAverin commented 9 years ago

Any easy way or some guide on how can I add this project as a library? I've got an existing project, with Libraries folder. I put all project-dependencies to that folder changing how they are refrenced in build.gradle files. But the problem that is left is that main build.gradle file that is in the root of your project folder has some options defined, like androidMinSdk(), for example. Should I move those defenitions to my main project build.gradle?

hjanetzek commented 9 years ago

I'm not sure how to this in android-studio. Have you tried 'gradle install' the vtm projects and then using them in your apps build.gradle?

AAverin commented 9 years ago

I managed to add it to my project and made it work. Just thought there is some guide available. I added it partially ( didn't need desktop and ios), and had to modify gradle files too. The best would be to have a way to clone repository to a separate folder within your project and somehow add it without gradle files modification. Not sure if it's possible. But that will help keeping library up to date with github. In my case I'll have to sync changes manually. Not that it's an uncommon way to go - facebook does the same, they don't even have gardle artifact avaialble=)

AAverin commented 9 years ago

What are the absolute essential parts of the library that are required for Android application? The problem I have stumbled upon is that with the libraries I already use adding OpenScienceMap hits the dex number of methods addressing issue, and I have to use MultiDexApplication that was just recently added by google. It's not yet 100% supported, so on some devices unpacking multiple dex files takes too much time. So, best would be to somehow squeeze into 64K of methods that are available for addressing within one Dex file. To do that I will have to remove as much of the library code as possible.

What I have added at the moment: vtm vtm-android vtm-ext-libs vtm-extras vtm-jeo vtm-themes

This list was based upon android-samples project. Anything I can remove?

hjanetzek commented 9 years ago

Only vtm and vtm-android are mandatory. ext-libs is included by vtm-android aar. I've added a minimal example for AndroidStudio (improvements are very welcome as I dont use AS myself) https://github.com/opensciencemap/vtm-android-studio-starter-pack

AAverin commented 9 years ago

Cool, thanks. vtm lib is in the maven central repo or there is a requirement to setup a local maven repo somehow? Right now I have everything added as a library-project so I would be able to get to the source when necessary.

hjanetzek commented 9 years ago

The './gradlew clean install' command should install everything to your local maven repo, which is basically just a folder in ~/.m2

AAverin commented 9 years ago

Do gradle exposed libraries have sources/javadoc included? I know there are issues downloading sources/javadoc for libraries, but maybe it will work somehow.

jamelcharouel commented 9 years ago

Hi,

I know this is very late but I'm hoping to get a response :) Could you explain to me how you added the OpenScienceMap to your android project? I want to create an application that lets the user import their own 3D object and use it with the maps but I can't figure out how to import the OpenScienceMap as a library. Thanks :)