How to successfully add the google play library service to android studio

I am trying to add a library google play servicefor a project through Mavenin android studio, but it has a lot of problems.

First release - Multiple dex files define:

repositories {
    mavenCentral()
}
dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.google.android.gms:play-services:+'
}

I researched, changed like this:

    repositories {

        mavenCentral()
}

    dependencies {

        compile fileTree(dir: 'libs', include: '*.jar')
       // compile 'com.google.android.gms:play-services:+'

        compile 'com.google.android.gms:play-services:4.3.23'{
         exclude module: 'support-v4'
}

       compile 'com.android.support:support-v4:18.0.+'

    }

But I get another error Build script error, unsupported Gradle DSL method found: 'com.google.android.gms:play-services:4.3.23()'!

I do not understand why I got this error.

Can people tell me how to add a library google play servicefor a successful project through Maven?

Thank,

+4
source share
3 answers

I need to modify the build.gradle file to look like this:

repositories {
    mavenCentral()
}
dependencies {

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

Restart android studio and sync my project. The problem is resolved.

, google play service -, : Android Studio Google Play

0

,

  • .
  • " "
  • "",
  • (+),
  • Gradle
0

build.gradle:

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

repositories {
    mavenCentral()
}

dependencies {
    // http://gradleplease.appspot.com/
    compile 'com.google.android.gms:play-services:4.3.23'
    compile 'com.googlecode.android-query:android-query:0.25.9'
    compile 'com.android.support:support-v13:19.0.1'
    compile 'com.google.code.gson:gson:2.2.4'
    compile 'org.jsoup:jsoup:1.7.3'
    compile 'org.apache.commons:commons-io:1.3.2'
    compile files('libs/libGoogleAnalyticsServices.jar')
}

dependencies, , http://gradleplease.appspot.com/

-1

Source: https://habr.com/ru/post/1537996/


All Articles