I have cloned the osmdroid repository from
https://github.com/osmdroid/osmdroid
and I am unable to get it to build. I'm focussed on the OpenStreetMapViewer project in the repository.
I think the source of the problem is that I cannot use maven because I am behind a firewall. For all Android Studio projects I have created or cloned, I have to modify the build.gradle by removing
mavenCentral
jcenter {
url "http://jcenter.bintray.com/"
}
build.gradle
dependencies
dependencies {
compile 'com.android.support:appcompat-v4:22.2.+'
compile 'org.osmdroid:osmdroid-android:4.3'
compile 'org.osmdroid:osmdroid-third-party:4.3'
}
compile 'com.android.support:appcompat-v7:23.0.1'
compileskdversion
Error:A problem occurred configuring root project 'OpenStreetMapViewer'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not resolve android.support:compatibility-v4:21.0.3.
Required by:
:OpenStreetMapViewer:unspecified > org.osmdroid:osmdroid-third-party:4.3
> Could not GET 'https://repo1.maven.org/maven2/android/support/compatibility-v4/21.0.3/compatibility-v4-21.0.3.pom'.
> peer not authenticated
> Could not resolve com.google.android.gms:google-play-services:22.0.0.
Required by:
:OpenStreetMapViewer:unspecified > org.osmdroid:osmdroid-third-party:4.3
> Could not GET 'https://repo1.maven.org/maven2/com/google/android/gms/google-play-services/22.0.0/google-play-services-22.0.0.pom'.
> peer not authenticated
Error: Cause: peer not authenticated
Untrusted Server's certificate - Server's certificate not trusted.
Issued to: Common Name plugins.jetgrains.com
Organization: Jetbrains.s.r.o
Locality: Praha 4 - Nusle
Country: CZ
ST: Praha 4 - Nusle
<localRepository>D:\Users\myusername\AndroidstudioProjects\maven-android-sdk-deployer</localRepository>
path
mvn install
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/com/simpligility/maven/progressive-organization-pom/3.0.0/progressive-organization-pom-3.0.0.pom
[ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.simpligility.android.sdk-deployer:maven-android-sdk-deployer:2.8.0: Could not transfer artifact com.simpligility.maven:progressive-organization-pom:pom:3.0.0 from/to central (https://repo.maven.apache.org/maven2):
sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target and 'parent.relativePath' points at wrong local POM @ line 5, column 11
@
The build could not read 1 project -> [Help 1]
The project com.simpligility.android.sdk-deployer:maven-android-sdk-deployer:2.8.0 (D:\maven-android-sdk-deployer\pom.xml) has 1 error
Non-resolvable parent POM for com.simpligility.android.sdk-deployer:maven-android-sdk-deployer:2.8.0: Could not transfer artifact com.simpligility.maven:progressive-organization-pom:pom:3.0.0 from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target and 'parent.relativePath' points at wrong local POM @ line 5, column 11 -> [Help 2]
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
D:\Program Files\apache-maven-3.3.3\conf/settings.xml
<localRepository>D:\Users\myusername\AndroidstudioProjects\maven-android-sdk-deployer</localRepository>
mvn install -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true
Osmdroid uses maven. (see https://github.com/osmdroid/osmdroid/wiki/HowToMaven)
Basically, you need to get maven (at least version 3.2.1), the maven-android-sdk-deployer (https://github.com/simpligility/maven-android-sdk-deployer) and the osmdroid code.
git clone https://github.com/simpligility/maven-android-sdk-deployer
cd maven-android-sdk-deployer
mvn install -fn
Build osmdroid
git clone https://github.com/osmdroid/osmdroid.git
cd osmdroid
mvn clean install
Edit: There are some gradle support files for the example application, but you'll need to build the rest of the stuff using maven first. The gradle bits are there for convenance with android studio.
Edit: if you're on a windows box. try the following
Path for maven
set M2_HOME=D:\Program Files\apache-maven-3.3.3
set PATH=%PATH%;D:\Program Files\apache-maven-3.3.3\bin
set ANDROID_HOME=D:\whereever\android-sdk
Path for the maven-android-sdk-deployer
cd D:\...\maven-android-sdk-deployer
Run the deployer
mvn install -fn
Build osmdroid
cd D:\...\osmdroid
mvn clean install`
Another option:
I recently just pushed some gradle support files along with the gradle wrapper. It only builds the bare minimum at the moment but it may get you going.
git clone https://github.com/osmdroid/osmdroid.git
cd osmdroid
gradlew build