DKMudrechenko
DKMudrechenko

Reputation: 723

Android-studio unresolved dependency: android-maps-utils

I am using android-studio 0.6.1 and have all necessary google repositories installed in SDK manager: however when I try to build a project, gradle says about unresolved dependency:

Unresolved dependencies:
Error:com.google.maps.android:android-maps-utils:+

My build.gradle looks like this:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.11.+'

    }
}
apply plugin: 'android'
android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'
    defaultConfig {
        minSdkVersion 12
        targetSdkVersion 19
        versionCode 1
        versionName '0.1'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile project(':library')
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.google.maps.android:android-maps-utils:+'
}

I know I can just import all necessary instruments in library folder, however I would like to resolve this problem. Do you have any suggestions?

EDIT: Found a way to solve it: Looks like the problem was in absense of

compile 'com.android.support:support-v4:19.0.1'

in build.gradle, also I had to empty 'library' folder and delete the line in order to avoid 'duplicate packages' problem with support libraries:

compile project(':library')

So my final build.gradle file looks like this:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.11.+'

    }
}
apply plugin: 'android'
android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'
    defaultConfig {
        minSdkVersion 12
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }

    repositories {
        mavenCentral()
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }

    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
    compile 'com.google.android.gms:play-services:4.4+'
    compile 'com.android.support:support-v4:19.0.1'
    compile 'com.google.maps.android:android-maps-utils:0.3+'

}

Upvotes: 0

Views: 9607

Answers (3)

Asaf Pinhassi
Asaf Pinhassi

Reputation: 15573

Try to replace this:

 compile 'com.google.maps.android:android-maps-utils:0.3+'

with this

compile 'com.google.android.gms:play-services-maps:9.4.0'

Upvotes: -1

suba
suba

Reputation: 69

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    // Support Libraries
    compile 'com.google.android.gms:play-services:4.1.32'
    compile 'com.android.support:support-v4:19.0.1'
    compile 'com.google.maps.android:android-maps-utils:0.3+'
}

com.google.android.gms:play-services:3.1.36 can be downloaded by going to your SDK Manager and installing the Extras->Google Repository package (you may want to install the Extras->Android Support Repository as well while you are there). These allow Gradle to automatically use these resources without the need for library projects or jars manually added to your project.

Upvotes: 0

Andrew Gable
Andrew Gable

Reputation: 2752

The error is

Unresolved dependencies:
Error:com.google.maps.android:android-maps-utils:+

I'd say double check that you've got the dependency correctly defined. Looking at the Map Utils website leads me to believe you might want to declare the dependency with a version.

Replace

compile 'com.google.maps.android:android-maps-utils:+'

to

compile 'com.google.maps.android:android-maps-utils:0.3+'

Do a Gradle Sync and everything should build correctly.

Upvotes: 3

Related Questions