0

In my project I want use mapview in navigation draw activity but com.android.support:appcompat-v7:25.0.3 and com.google.android.gms:play-services:10.2.1 in my project gradle are against eachother. Which version is capable?

     apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.3'
    defaultConfig {
        applicationId ".....my project name......."
        minSdkVersion 15
        targetSdkVersion 25
        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(include: ['*.jar'], dir: 'libs')
    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:25.0.3'
    compile 'com.android.support:design:25.0.3'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.android.gms:play-services-plus:10.2.1'
    compile 'com.google.android.gms:play-services-maps:10.2.1'
    testCompile 'junit:junit:4.12'
    compile 'com.google.android.gms:play-services:10.2.1'
}
m-tech
  • 338
  • 2
  • 14

1 Answers1

0

Try adding apply plugin: 'com.google.gms.google-services'line at the bottom of your app/build.gradle file.

As discussed in The Google Services Gradle Plugin, as part of enabling Google APIs or Firebase services in your Android application you may have to add the google-services plugin to your build.gradle file:

dependencies {
    classpath 'com.google.gms:google-services:3.0.0'
    // ...
}

Moreover, the google-services plugin has two main functions:

  1. Process the google-services.json file and produce Android resources that can be used in your application's code.
  2. Add dependencies for basic libraries required for the services you have enabled. This step requires that the apply plugin: 'com.google.gms.google-services' line be at the bottom of your app/build.gradle file so that no dependency collisions are introduced. You can see the result of this step by running ./gradlew :app:dependencies.

See this related SO post and this documentation for additional insights

Teyam
  • 7,686
  • 3
  • 15
  • 22
  • This is my change but it dosnt work dependencies { ..... compile 'com.android.support:appcompat-v7:25.0.3' compile 'com.android.support:design:25.0.3' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'com.google.android.gms:play-services-plus:10.2.1' compile 'com.google.android.gms:play-services-maps:10.2.1' testCompile 'junit:junit:4.12' compile 'com.android.support:multidex:1.0.1' } apply plugin: 'com.google.gms.google-services' – m-tech Jul 18 '17 at 11:15
  • Error:(33, 0) Plugin with id 'com.google.gms.google-services' not found. Open File its error. – m-tech Jul 18 '17 at 11:29
  • Have you also added `classpath 'com.google.gms:google-services:3.0.0'` in your project's `build.gradle`? – Teyam Jul 18 '17 at 12:02
  • i do this no:---> 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:25.3.1' compile 'com.android.support:design:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' testCompile 'junit:junit:4.12' compile 'com.google.android.gms:play-services:10.2.1' classpath 'com.google.gms:google-services:3.0.0' } – m-tech Jul 18 '17 at 12:57
  • this is error----> Error:(32, 0) Gradle DSL method not found: 'classpath()' Possible causes: – m-tech Jul 18 '17 at 12:58