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

Compiling vtm-android-example with Android Studio 1.1.0 on Win7 #142

Closed bmarchionni closed 9 years ago

bmarchionni commented 9 years ago

Hi Everyone,

First this project looks great, I've been looking for an open source Android Map control for a long time and this one is simply amazing.

Now I've been trying to get into the code a bit but I'm stuck trying to compile the vtm-android-example module. I've used github to clone the vtm repo to a local folder and opened it in Android Studio 1.1.0. I ran into some errors building, making these changes got me a little further

Line 11: in build.gradle to dependencies { classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.3'

    classpath 'com.android.tools.build:gradle:1.1.0'

    // for aar/maven stuff
    // https://github.com/dcendents/android-maven-plugin
    classpath 'com.github.dcendents:android-maven-plugin:1.2'
}

I can now compile vtm-android-start. So far so good.But when I try to compile vtm-android-example I get this error that I can't seem to figure out:

Error:A problem occurred configuring project ':vtm-android-example'.

Artifact 'proj4j-jeo.jar (org.osgeo:proj4j:0.1.0)' not found. Searched in the following locations: https://repo1.maven.org/maven2/org/osgeo/proj4j/0.1.0/proj4j-0.1.0-jeo.jar

Can any one help?

Thanks in advance.

Brian

hjanetzek commented 9 years ago

could you try adding this line to build.gradle 'allprojects.repositories' section? osgeo is now 'boundless'..

maven { url 'https://github.com/opensciencemap/maven-repo/raw/master/' }
bmarchionni commented 9 years ago

Thanks for the help, unfortunately I'm still getting the exact same error. This is my build.gradle 'allprojects.repositories'

repositories {
    mavenCentral()
    // Jeo
    maven { url 'https://github.com/opensciencemap/maven-repo/raw/master/' }
    maven { url 'http://repo.boundlessgeo.com/main' }
    //maven { url 'https://github.com/hjanetzek/maven-repo/raw/master/' }
    mavenLocal()
    // Local andoird repo
    maven { url "${System.env.ANDROID_HOME}/extras/android/m2repository" }
}

I tried commenting out the "maven { url 'http://repo.boundlessgeo.com/main' }" as well but that didn't change anything. Whats weird is that if I browse through the files in http://repo.boundlessgeo.com/main I can find: http://repo.boundlessgeo.com/main/org/osgeo/proj4j/0.1.0/proj4j-0.1.0-jeo.jar So if its present there why is it looking in: https://repo1.maven.org/maven2/org/osgeo/proj4j/0.1.0/proj4j-0.1.0-jeo.jar

Brian

bmarchionni commented 9 years ago

Alright so I got it to compile.

I commented out mavenCentral() and synced my project. Not surprisingly a whole bunch of stuff failed but to my surprise proj4j-0.1.0-jeo showed up in my External Libraries. I then uncommented it and moved it down a line.

repositories {
    maven { url 'https://github.com/opensciencemap/maven-repo/raw/master/' }
    mavenCentral()
}

And now it works! I don't understand, why didn't it look in the github repository when it didn't find it in mavenCentral()?

Brian

bmarchionni commented 9 years ago

Well I think the solution above will help anyone else with this isssue.