Search code examples
androidmavenandroid-studioosmdroid

OSMDroid in Android Studio


I have imported the OSMDroid full project in Android Studio through POM.xml file. It was imported but following error occurred

2:00:03 AM Error when importing module 'Google wrapper sample application': Cannot find file C:\Users\DevilsDream\.m2\repository\com\google\android\gms\google-play-services\27.0.0\google-play-services-27.0.0.pom
2:00:12 AM Error when importing module '~apklib-com.google.android.gms_google-play-services_27.0.0': Cannot find file C:\Users\DevilsDream\.m2\repository\com\google\android\gms\google-play-services\27.0.0\google-play-services-27.0.0.apklib
2:00:12 AM Error when importing module '~apklib-com.google.android.gms_google-play-services_27.0.0': Cannot find sdk info for artifact com.google.android.gms:google-play-services:27.0.0
2:00:12 AM Error when importing module '~apklib-com.google.android.gms_google-play-services_27.0.0': Cannot find resolved info for artifact com.google.android.gms:google-play-services:27.0.0

What should I do to work with OSMDroid in Android Studio


Solution

  • osmdroid uses maven for a build system (for time being). The maven android plugin doesn't import correctly with android studio. You may have better luck with intellj. You shouldn't need to import the project into android studio. You really only need to include the dependencies of osmdroid in your project.

    Osmdroid does have gradle build files for the example application to ease development.

    per https://github.com/osmdroid/osmdroid/wiki/How-to-add-the-osmdroid-library-via-Gradle

    dependencies {
        compile 'org.osmdroid:osmdroid-android:4.4'
        compile 'org.slf4j:slf4j-simple:1.6.1'
    }
    

    You'll also want to consult the wiki on how to use Osmdroid here: https://github.com/osmdroid/osmdroid/wiki/How-to-use-the-osmdroid-library