play-services-measurement-based requested with several versions - android

Error:Failed to notify dependency resolution listener.
The library com.google.android.gms:play-services-measurement-base is being requested by various other libraries at [[15.0.2,15.0.2], [15.0.4,15.0.4]], but resolves to 15.0.4. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.intraday.geeks"
minSdkVersion 21
targetSdkVersion 26
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:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.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'
compile 'com.android.support:design:26.1.0'
implementation 'com.google.firebase:firebase-core:15.0.4'
implementation 'com.google.android.gms:play-services-location:15.0.4'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.0'
implementation 'com.firebaseui:firebase-ui:0.6.2'
}
apply plugin: 'com.google.gms.google-services'

Do you have the classpath 'com.google.gms:google-services:4.0.1'?
It is 4.0.1! I updated it from 4.0.0 to 4.0.1 and it is ok!
If it still doesn't work, you can do this, manually add and not use the plugin

There are several problems in your gradle, in general, the issue here is there is an incompatibility. With the latest Google Service version, Firebase an other Google libraries can be used in diferent version with no problem.
Upgrade your gradle: In the Project gradle, upgrade the gradle version
classpath 'com.android.tools.build:gradle:3.1.3'
You will have to updgrade gradle-wrapper.properties file as well
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Add in the project gradle the latest Google Services Version:
classpath 'com.google.gms:google-services:4.0.1'
Compile is no longer supported, so change it to implementation
implementation 'com.android.support:design:26.1.0'
Firebase-ui is no longer meant to be added all at once, remove it:
implementation 'com.firebaseui:firebase-ui:0.6.2' (delete that line)
Follow Firebase-ui docs to add the dependency you actually need

Related

Unable to use android.arch.lifecycle:extensions and com.android.support:preference

I need to use LifecycleObserver in my app (already existing one).
This's my build.gradle (app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "it.tux.app"
minSdkVersion 24
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'com.android.support:preference-v7:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "com.android.support:support-core-utils:27.1.1"
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v13:27.1.1'
implementation 'io.github.controlwear:virtualjoystick:1.9.2'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.jjoe64:graphview:4.2.2'
testImplementation 'junit:junit:4.12'
}
Of course I put also:
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
in project build.gradle.
After gradle sync I got an error about incompatibility between com.android.support:preference-v7:27.1.1 and androidx.* dependencies.
If I try to compile things get worse. How can I fix this?
Seems like you have mixed up both support library and androidX.
Migrate everything to androidX. Follow this official guide
1. With Android Studio 3.2 and higher, you can migrate an existing project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
2. In your gradle.properties file, add these lines:
android.useAndroidX=true
android.enableJetifier=true
Also take a look at this answer for details.

Firebase authentication and database linking

In android studio 3.1.3, for linking firebase auth "implementation 'com.google.firebase:firebase-auth:11.6.0'" and
for linking firebase database "implementation 'com.google.firebase:firebase-database:11.8.0'" are the default dependencies provided in app level gradle.
classpath 'com.google.gms:google-services:3.0.0' is the dependency added
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.project.arsalan.adda"
minSdkVersion 21
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'
}
}
}
repositories {
maven {
url "https://maven.google.com/"
}
}
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.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-core:9.8.0'
implementation 'com.google.firebase:firebase-auth:9.8.0'
implementation 'com.google.firebase:firebase-database:9.8.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'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.yarolegovich:lovely-dialog:1.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:percent:25.0.1'
}
apply plugin: 'com.google.gms.google-services'
in project level gradle.
I'm usung gradle 3.1.2
The different levels of firebase are causing me errors. Please provide a common level of firebase version that can be used with my gradle build.
just update them with
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
and your google gms update with
dependencies {
classpath 'com.google.gms:google-services:4.0.1'
// ...
}
Here is a link to see the latest Firebase SDK versions. I think it is a reasonable assumption to make that the latest ones will work together.
https://firebase.google.com/support/release-notes/android
I dunno if this problem's unique to Linux.. but anyway finally I had to downgrade the dependencies to get them working..
Module app (dependencies)
compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.google.firebase:firebase-auth:9.8.0'
Project
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.1'

version conflict firebase libraries

I am getting this 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 think the error I am getting is due to implementing com.google.firebase:firebase-messaging:17.1.0 because if I remove it, building is successful. But on trying version 16.0.1 of com.google.android.gms for messaging, I get this message:
Unable to resolve error
I think the error means that com.google.firebase:firebase-messaging:16.0.1 is unavailable. How can my problem be solved ?
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
defaultConfig {
applicationId "in.anamika.anamika"
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.1'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.9.7'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:27.1.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true
}
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
in Android studio there are 2 buld gradle file.
build.gradle (Project: ProjectName)
build.gradle (Module: App)
I failed to upgrade com.google.firebase:firebase-messaging:17.1.0 too and then I edit classpath 'com.google.gms:google-services:3.0.1' to classpath 'com.google.gms:google-services:4.0.1'in build.gradle (Project: ProjectName) and it works. i can finally upgrade to 17.1.0.
Check this out
You need to search over your native dependecies in node_modules for their build.gradle and in this files look for dependecies starting with com.google.android.gms or com.google.firebase. After that you need to exclude these internal dependecies and force use of same version everywhere.

Google Maps and Firebase android plugins dependency collision

I am working on android applications where I am working on Google maps and Firebase. I am putting latest links in my gradle file but it is giving me an error with a red line on GoogleMaps gradle link.
Error:
all gms/firebase libraries must use the exact same version specification (mixinb versions can lead to runtime crahes). Found versions 16.0.0, 15.0.4, 15.0.1. Examples include com.google.firbase:firebase-analytics:16.0.0 and com.google.android.gms:play-services-measurement-base:15.0.4
Gradle:
dependencies{
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.firebase:firebase-core:16.0.0'
}
classpath 'com.google.gms:google-services:4.0.0'
apply plugin: 'com.google.gms.google-services'
Make your play service dependency version equal and try like bellow
dependencies{
compile 'com.google.android.gms:play-services-maps:16.0.0'
compile 'com.google.android.gms:play-services-location:16.0.0'
compile 'com.google.firebase:firebase-core:16.0.0'
}
classpath 'com.google.gms:google-services:4.0.0'
apply plugin: 'com.google.gms.google-services'
There are two more dependencies that need to be added. All the dependencies that I wrote are mentioned below.
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.firebase:firebase-core:15.0.1'
compile 'com.google.firebase:firebase-analytics:15.0.1'
compile ' com.google.android.gms:play-services-measurement-base:15.0.4'
I got a perfect combination with Android SDK API 28
No error of any sort in gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.myapp.app"
minSdkVersion 15
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:28.0.0-rc01'
implementation 'com.android.support:design:28.0.0-rc01'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.github.medyo:android-about-page:1.2.4'
implementation 'com.google.firebase:firebase-messaging:11.8.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'

problems with 'com.android.support:appcompat-v7.27.1.1' in the gradle file

This is my dependencies file and there is an underlined red colored text on the compile 'com.android.support:appcompat-v7.27.1.1'
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.abc.mcaproject"
minSdkVersion 21
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'])
compile 'com.android.support:appcompat-v7.27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.google.firebase:firebase-messaging:11.6.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-storage:11.6.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'
This because of this I am having problems changing themes in the styles.xml
when you hover over the red line it may show you the image like this which I have attached below.
What it tells you is there is a conflict of the version in some libraries so it suggests us to add those. For my case first, it showed for CardView and then for Design. So I added to it. Below is the code for it.
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.payumoney.sdkui:plug-n-play:1.2.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
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'
}
so kindly add those it may be 2 or more than that.
Hope that helps.
In Android Studio 3.0 ,the compile configuration is now deprecated and should be replaced by implementation or api.
Just replace:
implementation 'com.android.support:appcompat-v7.27.1.1'
compile with implementation
testCompile with testImplementation.
debugCompile with debugImplementation.
androidTestCompile with androidTestImplementation.
compileOnly is still valid. It was added in 3.0 to replace provided and not compile.
for more information read this gradel doc
Reason of fail
You are using incompatible version of firebase with 27.1.1 support version.
Current version > 16.0.0 and you use 11.6.0.
Solution
Update your firebase dependencies versions. I suggest update target sdk version also.
Below is updated gradle as of date 1-10-2018, you can see firebase page to check latest version.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.abc.mcaproject"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
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.28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-database:16.0.2'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-storage:16.0.2'
}
apply plugin: 'com.google.gms.google-services'
Suggestion
Migrate to androidx because Android will not update support libraries after version 28.0.0.
just goto-> files->project structures->app->flavors
change your min SDK version and target SDK version to "API 27:"
then go to properties and check that your compile SDK version has also changed to the above version which you selected.
This worked for me.

Categories

Resources