0

for the first time I am using google maps in my android studio project I have added the dependency in my project but i ma geeting error

Here is all the code from build.gradle(project:Location) file of my project

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

here is the all the code from build.gradle(Module.app) file of my project

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.example.anonymous.location"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.google.android.gms.play-services:+7'
    testCompile 'junit:junit:4.12'
}

Here is the all code from my AndroidMenifest.xml file of my project

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.anonymous.location">

    <meta-data android:name="com.google.android.gms.version"
               android:value="@integer/
               google_play_services_version"/>

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
Umair
  • 585
  • 3
  • 9
  • 21

2 Answers2

1

compile 'com.google.android.gms.play-services:+7'

it should be-

compile 'com.google.android.gms:play-services:7+'

but you should avoid inexact versions, use more specific like "9.4.0" or whatever suits your application.

https://developers.google.com/android/guides/releases check here for the versions. check what functionality you want and use that version code. Also note the different variant of play-services are available.

Arnav M.
  • 2,590
  • 1
  • 27
  • 44
1

Like Arnav said, you have to use -

compile 'com.google.android.gms:play-services:7+'

Adding to that, if you want to check the latest dependency for any library, use this - Check latest version of any library

Sachin Aggarwal
  • 1,095
  • 8
  • 17