Can't integrate realm into android library module with kotlin - android

My top level build.gradle
apply plugin: 'kotlin'
buildscript {
ext.kotlin_version = '1.3.30'
repositories {
mavenLocal()
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
//region realm
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
//endregion
}
dependencies {
//region google()
classpath 'com.android.tools.build:gradle:3.3.2'
//endregion
//region jcenter()
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
//endregion
//region maven { url 'https://maven.fabric.io/public' }
//to check fabric gradle ver
//https://s3.amazonaws.com/fabric-artifacts/public/io/fabric/tools/gradle/maven-metadata.xml
classpath 'io.fabric.tools:gradle:1.+'
//endregion
//region realm
classpath "io.realm:realm-gradle-plugin:5.8.0"
//endregion
}
}
Here is my library module build.gradle
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'realm-android'
android {
...
defaultConfig {
...
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:${supportLibVer}"
implementation "io.reactivex:rxjava:${rxJavaVersion}"
implementation("io.reactivex:rxandroid:${rxAndroidVersion}") {
exclude group: 'io.reactivex', module: 'rxjava'
}
implementation("com.github.davidmoten:rxjava-extras:${rxExtrasVersion}") {
exclude group: 'io.reactivex', module: 'rxjava'
}
implementation('io.reactivex:rxjava-math:1.0.0') {
exclude group: 'io.reactivex', module: 'rxjava'
}
implementation "com.google.dagger:dagger:${daggerVersion}"
implementation("com.google.dagger:dagger-android-support:${daggerVersion}") {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-fragment'
}
annotationProcessor "com.google.dagger:dagger-compiler:${daggerVersion}"
kapt "com.google.dagger:dagger-compiler:${daggerVersion}"
annotationProcessor "com.google.dagger:dagger-android-processor:${daggerVersion}"
kapt "com.google.dagger:dagger-android-processor:${daggerVersion}"
implementation "javax.inject:javax.inject:${javaxInjectVersion}"
implementation "javax.annotation:jsr250-api:${javaxAnnotationVersion}"
implementation "com.android.support:support-annotations:${supportLibVer}"
...
}
In result I can't make Sync, error is:
ERROR: Unable to resolve dependency for ':module#debug/compileClasspath': Could not resolve all dependencies for configuration ':module:debugCompileClasspath'.
Show Details
Affected Modules: module
But if I remote
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
then all works fine
Found issue: it was because of I have failOnVersionConflict() at top build gradle

To fix the issue:
top build.gradle file:
buildscript {
ext.kotlin_version = '1.3.31'
repositories {
mavenLocal()
google()
jcenter()
//region realm
maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
maven { url 'https://dl.bintray.com/realm/maven' }
//endregion
}
dependencies {
//region google()
classpath 'com.android.tools.build:gradle:3.3.2'
//endregion
//region jcenter()
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
//endregion
//region realm
classpath "io.realm:realm-gradle-plugin:5.11.0"
//endregion
}
}
allprojects {
...
configurations.all {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jre7'
resolutionStrategy {
// fail eagerly on version conflict (includes transitive dependencies)
// e.g. multiple different versions of the same dependency (group and name are equal)
failOnVersionConflict()
//this is needed:
force "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version",
"org.jetbrains.kotlin:kotlin-android-extensions-runtime:$kotlin_version",
"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version",
}
}
}

I am currently using Realm with Kotlin. Here are my gradle files.
It seems like the order of Kotlin-kapt and kotlin-android-extensions in the app gradle should be switched around. Check below
App gradle file:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
android {
compileSdkVersion 28
defaultConfig {
applicationId "xxx"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:16.0.1'
// Add dependency
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
}
apply plugin: 'com.google.gms.google-services'
Root level gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.71'
ext.lifecycle_version = '2.0.0'
ext.anko_version='0.10.8'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.android.tools.build:gradle:3.2.1'
// Add dependency
classpath 'io.fabric.tools:gradle:1.26.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.realm:realm-gradle-plugin:5.10.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Change your root build.gradle to
apply plugin: 'kotlin'
buildscript {
ext.kotlin_version = '1.3.31'
repositories {
google()
jcenter()
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.realm:realm-gradle-plugin:5.11.0-SNAPSHOT"
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
}
and it should work just fine (it does sync on my sample project). Note the allprojects block that you forgot. Also, you should apply plugin: 'kotlin-kapt' last.

Related

Could not find method maven()

I am getting the following error :
Could not find method maven() for arguments [build_3sdtqstdmsgdnexrxaaxgljji$_run_closure1$_closure4#325a800c] on root project 'Appointments' of type org.gradle.api.Project.
Here's my Project Level Gradle File:
buildscript {
repositories {
google()
jcenter()
maven { url "http://jcenter.bintray.com"}
maven { url "https://maven.fabric.io/public" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.0'
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
maven {
url 'https://maven.google.com/'
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here's my app level Gradle File :
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.gtaandteam.android.wellcure"
minSdkVersion 19
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'
}
}
}
repositories {
mavenCentral()
maven {
url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'ai.devsupport.instamojo:instamojolib:0.1.6'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-crash:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation "com.android.support:design:24.2.0"
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'io.fabric'
I have tried all the techniques mentioned in other posts and solution website, but I dont find my same error listed in any of these websites. Hence I am creating this question here.
You're getting this error because your maven shouldn't be a direct child of "allprojects" but a direct child of "repositories".
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}

Dependencies conflicts after google-services 15

I want to use some Google Play services and some extra libraries in the same project. My app/build.gradle file looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "bahir.com.myapplication"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
// !!! problematic code !!!
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
compile 'com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.92'
}
apply plugin: 'com.google.gms.google-services'
And my root/build.gradle file looks like this:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.3.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
If I delete all 3 Google Play Service libs- it's runing good, or I have to delete this code:
// !!! problematic code !!!
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
and of course:
compile 'com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.92'
to have a successfully build, I suppose the conflict is into problematic code in app/build.gradle, so is there a way to declare repositories for a single lirary, in my case for compile 'com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.92' ???
Use the new plugin:
classpath 'com.google.gms:google-services:4.0.1'
AlphabetIndex-Fast-Scroll-RecyclerView using internally '25.3.1' you can exclude
compile("com.github.myinnos:AlphabetIndex-Fast-Scroll-RecyclerView:1.0.92") {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'design'
}

android can't add one singnal

I am trying to one signal to my project and i add dependencies like this
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.8.1'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
and in my build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.2.1'
classpath 'io.fabric.tools:gradle:1.24.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'http://jhoobin.abroid.com/repo/' }
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
google()
}
}
but i keep getting error when i sync the gradle
Error:Unable to resolve dependency for ':app#debug/compileClasspath': Could not find any version that matches com.google.android.gms:play-services:15.+.
Open FileShow Details
what is wrong with my code ?
These are my gradles.
This is my :app gradle
//noinspection GradleCompatible
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.app.app"
manifestPlaceholders = [onesignal_app_id: "APP_ID_HERE",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "PROJECT_NUMBER_HERE"]
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/commons-io-2.4.jar')
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.onesignal:OneSignal:3.+#aar'
// Required for OneSignal, even if you have added FCM.
compile 'com.google.android.gms:play-services-gcm:10.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
My main projects gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// 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
}

Android, Realm, Gradle: Error:Annotation processor: RealmProcessor not found

Android Studio 2.3.3
My project bulid.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.3'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:2.0.0-alpha6'
classpath "io.realm:realm-gradle-plugin:3.5.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://dl.bintray.com/jetbrains/anko' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
repositories {
mavenCentral()
}
My app build.gradle.
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
dexOptions {
jumboMode = true
}
defaultConfig {
applicationId "my.project.com"
minSdkVersion 15
targetSdkVersion 23
versionCode 53
versionName "1.1.13"
javaCompileOptions {
annotationProcessorOptions {
arguments = ["resourcePackageName": android.defaultConfig.applicationId]
}
}
}
// exclude buildTypes = "debug" from build Variants
variantFilter { variant ->
if (variant.buildType.name.equals('debug')) {
variant.setIgnore(true);
}
}
buildTypes {
def APP_NAME_STAGE = "My project Stage"
def APP_ID_SUFFIX_STAGE = ".stage"
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
stage {
initWith(debug)
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
abortOnError false
}
}
def AAVersion = '4.3.0'
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile('com.digits.sdk.android:digits:1.11.0#aar') {
transitive = true;
}
compile('com.crashlytics.sdk.android:crashlytics:2.6.0#aar') {
transitive = true;
}
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.volley:volley:1.0.0'
compile 'com.baoyz.swipemenulistview:library:1.3.0'
compile 'com.google.android.gms:play-services-gcm:9.0.2'
compile 'com.google.code.gson:gson:2.7'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.7.3'
compile 'com.squareup.okhttp:okhttp:2.7.3'
compile 'com.theartofdev.edmodo:android-image-cropper:2.2.5'
compile 'commons-codec:commons-codec:1.9'
compile 'commons-io:commons-io:2.4'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'org.apache.httpcomponents:httpcore:4.4.4'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile 'us.feras.mdv:markdownview:1.1.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'org.jetbrains.anko:anko-sdk15:0.9.1'
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
testCompile 'junit:junit:4.12'
}
And project bulid and run success.
So now I want to add Realm. I add in build.gradle
apply plugin: 'realm-android'
And as result I get error.
Error:Annotation processor '__gen.AnnotationProcessorWrapper_stage_io_realm_processor_RealmProcessor' not found
Error:Execution failed for task ':app:compileStageJavaWithJavac'.
Compilation failed; see the compiler error output for details.
:app:compileDevJavaWithJavac
Destination for generated sources was modified by kapt. Previous value = myProject\app\build\generated\source\apt\dev
error: Annotation processor '__gen.AnnotationProcessorWrapper_dev_io_realm_processor_RealmProcessor' not found
I found solution. Two approach:
By apt plugin
in app's budile.gradle:
apply plugin: 'com.neenbedankt.android-apt'
apt {
arguments {
resourcePackageName android.defaultConfig.applicationId
androidManifestFile variant.outputs[0]?.processResources?.manifestFile
}
}
dependencies {
apt 'io.realm:realm-android-library:3.5.0'
apt "org.androidannotations:androidannotations:$AAVersion"
}
OR
By kapt plugin
apply plugin: 'kotlin-kapt'
kapt {
arguments {
arg( "resourcePackageName", android.defaultConfig.applicationId)
arg( "androidManifestFile",
variant.outputs[0]?.processResourcesTask?.manifestFile)
}
}
dependencies {
kapt 'io.realm:realm-android-library:3.5.0'
kapt "org.androidannotations:androidannotations:$AAVersion"
}
If you use Kotlin, then you'll need to use KAPT.
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
should be
kapt "org.androidannotations:androidannotations:$AAVersion"
and
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
should be
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
and
// javaCompileOptions {
// annotationProcessorOptions {
// arguments = ["resourcePackageName": android.defaultConfig.applicationId]
// }
// }
kapt {
arguments {
arg('resourcePackageName', android.defaultConfig.applicationId)
}
}
EDIT: based on https://stackoverflow.com/a/34708575/2413303
kapt {
arguments {
arg('androidManifestFile', variant.outputs[0]?.processResources?.manifestFile)
arg('resourcePackageName', android.defaultConfig.applicationId)
}
}
If that still doesn't work, then the question becomes AndroidAnnotations related.

Gradle DSL method not found: 'classpath()' after adding firebaseui libraries

I've added firebase UI libs, and after adding Google maven I get error.
Possible cause is that I’m using version of the Android Gradle plug-in that does not contain the method, but I've upgraded plugin and still getting error.
Here is module Gradle file :
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
dexOptions {
javaMaxHeapSize = "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.firebase:firebase-core:11.0.2'
compile 'com.google.firebase:firebase-storage:11.0.2'
compile 'com.google.firebase:firebase-auth:11.0.2'
compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.firebaseui:firebase-ui:2.1.0'
}
apply plugin: 'com.google.gms.google-services'
and project Gradle files :
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenLocal()
}
}
dependencies {
apply plugin: 'idea'
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
After changing project Gradle files, I've got solution :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
} }
You have one } that is not in its place.
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
apply plugin: 'idea'
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Categories

Resources