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'
Related
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'
After I have added the firebase ads dependency implementation'com.google.firebase:firebase-ads:15.0.1'
now I am getting the followiing Error:
Error:The library com.google.firebase:firebase-analytics is being requested by various other libraries at [[15.0.1,16.0.0), [16.0.0,16.0.0], [16.0.0,99999]], but resolves to 16.0.0. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
but I haven't added a analytics dependency since I don't need that, but I added it anyway to see weather it solves the problem but I am still getting the same error
the following is my build.gradle(module app)
//noinspection GradleCompatible
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.rimapps.midippu"
minSdkVersion 15
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 'com.android.support:support-annotations:27.1.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.android.support:support-v4:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
//noinspection GradleDynamicVersion
implementation 'com.android.support:cardview-v7:26.1.0+'
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-core:16.0.0'
apply plugin: 'com.google.gms.google-services'
implementation'com.google.firebase:firebase-analytics:16.0.0'
implementation 'com.google.firebase:firebase-firestore:17.0.1'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.squareup.okhttp3:okhttp:3.9.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
Is there anything I can do?
It worked after I updated my classpath dependency to classpath 'com.google.gms:google-services:4.0.1' in my project gradle
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.
I am trying to completely remove OneSignal library ,
I have deleted its library from dependencies
This is gradle app code
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "xxx.xxxxxx.xxxxx"
minSdkVersion 17
targetSdkVersion 26
versionCode 3
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
repositories {
jcenter()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.firebaseui:firebase-ui-database:3.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:2.2.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.facebook.android:account-kit-sdk:4.+'
compile 'com.google.android.gms:play-services:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.whalemare:sheetmenu:1.3.3'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.android.support:recyclerview-v7:+'
implementation 'com.squareup.picasso:picasso:2.71828'
compile 'de.hdodenhof:circleimageview:2.2.0'
}
apply plugin: 'com.google.gms.google-services'
The problem is that I can't remove this line
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
when I delete it and put apply plugin: 'com.android.application' in the first line
I get this error
How can I fix this error ? Or What is the right way to remove OneSignal ?
You're using the wrong version of the appcompat-v7 library i.e. 26.1.0 instead of 27.1.0. Also, you've to use the support-compat library:
def final support_libraries_version = '27.1.0'
implementation "com.android.support:appcompat-v7:${support_libraries_version}"
implementation "com.android.support:support-compat:${support_libraries_version}"
which means you'll also have to change your compile sdk version to 27:
compileSdkVersion 27
I'm trying to include Firebase Authentication in my Android app, but when I compile my program I get the error
Program type already present: com.google.android.gms.auth.api.signin.internal.zzp
Changing the version from 11.8.0 to 11.2.2 worked, but I need to use Firestore, which only has 11.8.0, and the two are incompatible. Here's my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.my.app"
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'])
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.google.firebase:firebase-auth:11.8.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.firebaseui:firebase-ui-auth:3.1.0'
implementation 'com.google.firebase:firebase-firestore:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
Is there a conflicting file I need to delete?
You need to change this:
implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
to this:
implementation 'com.firebaseui:firebase-ui-auth:3.2.1'
Also there is no firebase 11.2.2, I think you meant 11.4.2 which is compatible with the above firebase ui version.
The firebase version 11.8.0 is compatible with firebaseui 3.2.1
You can check this table here: https://github.com/firebase/FirebaseUI-Android#compatibility-with-firebase--google-play-services-libraries