javaandroidgeotools

How to integrate GeoTools library in android Project


I am trying to integrate geotools libray, but I am getting error please help to integrate i have done following step for integration.

I am getting error: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.

Could not find org.geotools:geotools:29.2.

Please help me to integrate

Project level build.gradle

plugins {
    id 'com.android.application' version '8.0.2' apply false
    id 'com.android.library' version '8.0.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
}

app level build.gradle dependencies

dependencies {
    implementation 'androidx.core:core-ktx:1.8.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.5.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'io.oss84.geotools:geotools:24.2-oss84-1'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    implementation 'org.geotools:geotools:29.2'
}

settings.gradle

pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
        maven { url 'https://jitpack.io' } // Add GeoTools repository
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
    }
}
rootProject.name = "GeoToolsAndroid"
include ':app'

Solution

  • As the manual helpfully states GeoTools stores its release jars at https://repo.osgeo.org/repository/release/

    Also, much of GeoTools depends on the SPI tools to load datastores and other plugins so it won't work on Android unless you rewrite the loader.