Issue
My project was working. But when I tried to open the project, android studio gave error:
Could not find method compile() for arguments [com.google.gms:google-services:4.2.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Project gradle file are like below:
buildscript {
ext.kotlin_version = '1.2.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
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
compile 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
maven{url 'https://jitpack.io'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App gradle file are like below:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.asnus.moviefinder"
minSdkVersion 19
targetSdkVersion 28
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'])
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compile 'com.android.support:appcompat-v7:28.0.0-rc01'
compile 'com.android.support.constraint:constraint-layout:1.1.2'
compile 'com.android.support:support-v4:28.0.0-rc01'
compile 'com.android.support:design:28.0.0-rc01'
testCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:1.0.2'
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.2'
//cardview
compile "com.android.support:cardview-v7:28.0.0-rc01"
//recylerview
compile 'com.android.support:recyclerview-v7:28.0.0-rc01'
//picasso
compile 'com.squareup.picasso:picasso:2.71828'
//retrofit
compile 'com.squareup.retrofit2:retrofit:2.4.0'
compile 'com.squareup.retrofit2:converter-gson:2.4.0'
//Firebase
compile 'com.google.firebase:firebase-auth:16.0.3'
compile 'com.google.android.gms:play-services-auth:16.0.0'
compile 'com.google.firebase:firebase-firestore:17.1.0'
//Seekbar
compile 'com.crystal:crystalrangeseekbar:1.0.0'
//Search Dialog
compile 'com.github.mirrajabi:search-dialog:1.1'
//Fab Button
compile 'com.github.dimorinny:floating-text-button:0.0.4'
//Circle ImageView
compile 'de.hdodenhof:circleimageview:2.1.0'
}
apply plugin: 'com.google.gms.google-services'
Solution
Add maven { url 'https://dl.bintray.com/android/android-tools' }
in your project's build.gradle
like this:
buildscript {
repositories {
maven { url 'https://dl.bintray.com/android/android-tools' }
...
}
}
For more information see this answer
Answered By - EgorD
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.