0

How to add google maps v2 sdk to maven project as dependency? I am using jar file but project need resource. How i can add them?

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Mecid
  • 4,491
  • 6
  • 30
  • 30
  • You cannot add "Android libraries" as jar, because you need the resource folders as well. You need to include it as an android project library (Eclipse), or module (Intellij IDEA). I use two libraries this way and after struggling 20hours with maven I've temporarily given up using maven for this project. Don't hesitate to tell me if you come by a solution :) – Thibault D. Feb 22 '13 at 21:21

2 Answers2

3

You should be able to use my Maven Android SDK Deployer to get the the Play services install into your local Maven repository or deployed to your repository manager and then add a apklib dependency to the Google Play Services, which contains the maps stuff.

More at https://github.com/mosabua/maven-android-sdk-deployer

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123
0

It looks like the Maps v2 API is part of Google Play Services. So from the SDK manager, you need to make sure it's installed (under the 'Extras' category.) Then use the maven-android-sdk-deployer (as Manfred pointed out) to install the extras/google-play-services package. Then use this in your POM:

<dependency>
    <groupId>com.google.android.gms</groupId>
    <artifactId>google-play-services</artifactId>
    <version>7</version>
    <type>apklib</type>
</dependency>
<dependency>
    <groupId>com.google.android.gms</groupId>
    <artifactId>google-play-services</artifactId>
    <version>7</version>
    <type>jar</type>
</dependency>

I noticed this when the maps JAR I was using has the package name com.google.android.maps but the v2 API uses com.google.android.gms.maps

thom_nic
  • 7,809
  • 6
  • 42
  • 43