Android google services plugin version conflict - android

I recently upgraded Android Studio to 3.1 and I am tuck with version conflict problem.My Gradle version is 4.4 and Andoid plugin version is 3.0.0. I tried changing it to 3.1.1.It gets reverted back to the previous version mumber. It is getting confusing for me,so your help is needed. When syncing I get the following message in the Build.
Version Conflict:
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.4.2.
build.gradle/app
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.globemaster.samples"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support:design:27.0.0'
implementation 'com.payumoney.sdkui:plug-n-play:1.2.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.2.1'
// 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
}

Move this line at last
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.globemaster.samples"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//
//
}
apply plugin: 'com.google.gms.google-services'
At the bottom of the (app)build.gradle script and rebuild the project.
Note:- I think that it has to do something with referencing
dependencies that have not yet been created. Something like calling a
variable before you even declare it

Pls add below code in your app build gradle.file
apply plugin: 'com.google.gms.google-services'

I hope this will work for you
Change your classpath to 3.1.1
classpath 'com.android.tools.build:gradle:3.1.1'
And apply plugin after dependencies in app gradle file
apply plugin: 'com.google.gms.google-services'

Related

Unable to resolve error of gradle version when migrating to AndroidX

When I tried to migrate my own project to AndroidX, the error message appeared on a error dialog:
The gradle plugin version in your project build.gradle file needs to be set to at least com.android.tools.build:gradle:3.2.0 in order to migrate to AndroidX.
Then I googled this error on the Internet. A site was found that it said classpath 'com.android.tools.build:gradle:3.2.0' has to be added to the build.gradle. Therefore, I added the line to the build.gradle like this:
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:support-core-utils:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
However, the same error happened. Am I missing something?
Check your build.grade of Project level ( Not Module )
And change the version of the android gradle plugin:
buildscript {
...
dependencies {
...
classpath 'com.android.tools.build:gradle:3.4.1' // it should be more than 3.2.0
}
}

what versions of firebase and google maps should i use?

I am trying use firebase and Google maps in the same app but each time i sync the gradle files i get the following error:
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 16.0.1.
I have tried changing the play-services version but that has not solved the issue.
Below are the two gradle files
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.myteam"
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
root project build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.1.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Android Studio should tell you which versions are hopelessly outdated... which are commonly indicated with a yellowish background - and update suggestions are being shown, when hovering these with the mouse. telling how it works might be a better answer, than doing your job.
buildscript {
...
dependencies {
classpath "com.android.tools.build:gradle:3.2.1"
classpath "com.google.gms:google-services:4.2.0"
}
}
this should at least fix the one issue, while the other build.gradle has further outdated versions.

All gms/firebase libraries must use the exact same version (mixing versions can lead to runtime crashes).Found versions 16.1.1 16.0.1 16.0.0 15.0.1

Trying to implement Firebase in my project but implementation 'com.google.firebase:firebase-core:16.0.1' ths line underlined. Please.
Thanks Mbuodile Obiosio but not work, I don't know.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.harun.basicmathquiz"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
AND
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.1'
// 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
}
MY ERROR: All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 16.1.1, 16.0.1, 16.0.0, 15.0.1. Examples include com.google.firebase:firebase-analytics-impl:16.1.1 and com.google.firebase:firebase-analytics:16.0.1
Upgrade the google-service plugin in the top level gradle file, to avoid the mixing version error:
classpath 'com.google.gms:google-services:4.0.1'
https://bintray.com/android/android-tools/com.google.gms.google-services/
I am also faced with the same problem. My problem is solved by doing this
add the following in Gradle
classpath 'com.google.gms:google-services:4.0.1'
And in dependencies
dependencies {
.
.
.
implementation ('com.google.firebase:firebase-database:16.0.1') {
exclude group: "com.google.android.gms"
}
}
apply plugin: 'com.google.gms.google-services'
You're mixing versions and that's why you're getting the error.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.harun.basicmathquiz"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
Don't forget to update the top level build.gradle file with
classpath 'com.google.gms:google-services:4.0.1'

Android Studio: Gradle Build Error No repositories are defined

Andriod Studio 3.3.1
gradle 4.4
I added firebase storage through the Android > Tools > Firebase option. However when I sync the gradle the build fails. This is the error that I'm getting:
Cannot resolve external dependency com.google.gms:google-services:3.2.1
because no repositories are defined. Required by:project :app
Does anyone know how to correct this error?
build.gradle (Module: APP)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.test"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-storage:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
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:27.1.1'
//implementation 'com.google.android.gms:play-services:11.0.4'
}
buildscript {
dependencies {
classpath 'com.google.gms:google-services:3.2.1'
}
}
apply plugin: 'com.google.gms.google-services'
In my case, I have to add below code to project level gradle:
allprojects {
repositories {
google()
jcenter()
}
}
The error indicates that repositories is missing in order to determine from where google-services will be downloaded.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.gms:google-services:3.2.1'
}
}
jcenter is a reference to bintray jcenter. Gradle can find the google-services:3.2.1 there.
In my case I was able to get it working by adding another repository scope to the top level.
repositories {
mavenLocal()
mavenCentral()
}
I was inspired to do so by this example.

Troubles with integrating firebase in my app

So i am using the firebase assistant to integrate a "real-time database" into my app but i am having some troubles with the gradle files
here is my project gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
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 {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here is my module gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.matei.gotcha20"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible,GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-database: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'
compile 'com.google.android.gms:play-services:11.6.2'
annotationProcessor 'com.jakewharton:butterknife:6.1.0'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'com.android.support:support-annotations:27.0.2'
compile "com.google.firebase:firebase-auth:11.6.2"
compile 'com.github.clans:fab:1.6.4'
}
apply plugin: 'com.google.gms.google-services'
The error i am getting is the following:Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.6.2.
If i delete this line
apply plugin: 'com.google.gms.google-services'
it works but the firebase assisstant add that line automatically when i click on "integrate real-time database"
Your Firebase database dependency is 11.0.4 and auth is 11.6.2
Make both 11.6.2
Also use google services version 3.1.1 in your root level gradle file

Categories

Resources