When add firebase in
dependencies
implementation 'com.google.firebase:firebase-core:16.0.6'
Or
implementation 'com.google.firebase:firebase-ads:17.1.2'
Or
implementation 'com.google.android.gms:play-services-ads:17.1.1
It shows error under implementation 'com.android.support:appcompat-v7:28.0.0' that All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes).
When I sync the app no error but when install the app it shows you app has been stopped (Crashing during run time).
When remove the firebase dependencies and run, my app it's working fine.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design: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'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-ads:17.1.2'
implementation 'com.google.android.gms:play-services-ads:17.1.1'
}
apply plugin: 'com.google.gms.google-services'
When you include dependencies, they too, will sometimes include dependencies of their own. Some of the firebase libraries happen to include support libraries at a lower version than 28. When you hover over the error message for appcompat-v7 it should tell you what library is lower than 28. You may have to click 'show more' on the error message. Once you figure out which one it is, include that exact same library but version 28. Resync your gradle and you're good to go. Also, you might have to do this multiple times because some firebase libraries include multiple lower version support libraries and the error message will only show you one library at a time.
Related
I am having trouble in generating signed apk. Lint errors displayed on screen
Following error shows
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.0. Examples include 'com.android.support:animated-vector-drawable:28.0.0' and 'com.android.support:exifinterface:27.1.0'
Dependencies in build.gradle file is below:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
//picasso libraray
implementation 'com.squareup.picasso:picasso:2.71828'
//retrofit libraries
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.okhttp3:okhttp:4.3.1'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
}
On this line
implementation 'com.android.support:appcompat-v7:28.0.0'
lint error occurred
AndroidX replaces the original support library APIs with packages in
the androidx namespace. Only the package and Maven artifact names
changed; class, method, and field names did not change.
Read official guideline about - Migrating to AndroidX. You should migrate to AndroidX.
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.
dependencies will be
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
Then add below in your build.gradle section.
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
}
Tried to add Firebase UI implementation
implementation 'com.firebaseui:firebase-ui-database:6.2.0'
in build.gradle file.
The following error was shown.
*ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.firebaseui:firebase-ui-database:6.2.0.
Affected Modules: app*
Please guide me how to resolve the issue.
I am using Android Studio 3.5.3
Other dependencies I have already implemented in the app
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
You need to update the following dependencies:
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
to
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0
Also upgrade to androidX. Check the following for more information:
From the docs:
FirebaseUI version 6.0.0 has no breaking API changes from version 5.1.0 but updates critical dependencies to new major versions.
There are two major groups of changes:
Convert all Android Support Library dependencies to AndroidX or Jetpack dependencies. For information on migrating to AndroidX see this guide.
Update all Firebase and Google Play services dependencies to their latest major versions. For information on changes included in these SDKs visit the release notes.
You can follow these steps:
Press F4 to open Module settings
Select Dependency
Click Add new dependency
Type firebase, search for firebase.ui and add its latest dependency.
At last I was able to sync successfully without Error.
The final dependencies in the build.gradle file of the app.
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.2.0-alpha03'
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha01'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.firebaseui:firebase-ui-database:6.2.0'
I have following dependencies in my android studio project.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.google.android.gms:play-services: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'
}
I just added com.google.android.gms:play-services and I can't figure out why the following error is occuring:
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 25.2.0. ...
Does anyone know how to solve this problem. I assume it has got to do with the play services dependency using a different versions of android.support, or something similar, but can't find a single solution on the internet.
P.S I'm using kotlin if that makes any difference
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.3'
implementation 'com.firebase:firebase-client-android:2.5.2+'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.volley:volley:1.1.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.google.firebase:firebase-auth:16.0.1:15.0.0'
}
I don't know but the error only shows the appcompat 28.0.0 won't work.
Change
this, implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
to this, implementation 'com.google.firebase:firebase-auth:16.0.1'
and better, update all dependencies to the latest versions
The following dependency is put in by the Firebase Assistant to "Add Firebase Authentication to the App"
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0'
If you remove 15.0.0, and make it
implementation 'com.google.firebase:firebase-auth:16.0.1'
that automatically removes Firebase Authentication in the Firebase Assistant, beating the whole purpose. Also if you change to the '...firebase-auth:16.0.1:15.0.0' to the latest version '...firebase-auth:16.1.0:15.0.0', nothing happens to the error, as it is due to the '15.0.0' part.
This is probably a blocker bug from Firebase or Google side, which could be only corrected by them. Hope this catches their attention soon. Otherwise all new developments using this version of Firebase Auth or Database will be stalled. Older versions may be working though.
I just got the android studio and all I did was connecting with the firebase. But I was not able to fully connect because of the appcompat error. I have attached the photo of what I'm getting.
dependencies {
implementation fileTree(dir: 'libs',include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0' <--------------getting error here
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth: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'
}
Error
Dependencies
I look at your error message and it felt familiar as i had received same message so many times!
Root cause is mixing version numbers in dependencies. it seems that in your dependencies you have version 28 and version 25 mixed up. go to build.gradle and put cursor on version number on each of your dependancies and then press ALT+ENTER. go with what android studio suggests and then clean->rebuild. it should work.
Hope this helps!