How to fix dependency conflict? - android

Where's the conflict, how to fix it, and to find in the future the source of conflict?
What went wrong: 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 16.0.0.
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 17
targetSdkVersion 27
}
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.google.maps.android:android-maps-utils:0.4.3'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-crash:16.0.0'
apply plugin: 'com.google.gms.google-services'

One of your dependency is having different version of com.google.android.gms.
I inspected com.google.maps.android:android-maps-utils:0.4.3 from github page. I found that it is using very old version of maps, see on above page.
dependencies {
compile 'com.google.android.gms:play-services-maps:11.0.4'
}
As solution you can
Either downgrade your play-service dependency versions as same as maps-utils
Or you can upgrade this dependency gms version by downloading from github page, and add as module in your project.
Keep in mind if you use latest version of gms dependencies in your app, then use latest google-services in project level build.gradle. Like
classpath 'com.google.gms:google-services:3.3.0'
Edit
Use this config to downgrade your version of gms and firebase.
def GMS_VERSION = "11.0.4"
def FCM_VERSION = "11.0.4"
dependencies {
// ...
implementation "com.google.android.gms:play-services-analytics:$GMS_VERSION"
implementation "com.google.android.gms:play-services-location:$GMS_VERSION"
implementation "com.google.android.gms:play-services-maps:$GMS_VERSION"
implementation "com.google.android.gms:play-services-places:$GMS_VERSION"
implementation 'com.google.maps.android:android-maps-utils:0.4.3'
implementation "com.google.firebase:firebase-messaging:$FCM_VERSION"
implementation "com.google.firebase:firebase-crash:$FCM_VERSION"
}

One of your dependency is having different version of com.google.android.gms.
exactly. At Google, they seem to fix it like (old note):
configurations.all {
resolutionStrategy.force "com.android.support:support-annotations:$rootProject.supportLibraryVersion"
}
So find out the common/latest used version, and then use resolutionStrategy.force.

Related

Could not determine the dependencies of task ':app:compileDebugJavaWithJavac' Flutter

When I start my flutter app, Im getting this error:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[19.0.
2]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
My dependencies in build gradle:
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-basement:17.4.0'
implementation 'com.google.firebase:firebase-analytics:18.0.0'
implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
implementation 'com.google.firebase:firebase-perf:19.0.10'
implementation 'com.google.firebase:firebase-database'
}
apply plugin: 'com.google.gms.google-services'
Please help me) Thanks in advance
To prevent versioning conflicts between Firebase SDKs, I recommend using the Firebase Bill of Materials (BoM) to manage the versions.
With the BoM, you'd have the following dependencies for Firebase:
dependencies {
implementation platform('com.google.firebase:firebase-bom:26.2.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-perf'
implementation 'com.google.firebase:firebase-database'
}
So as you can see, the only version we specify is for the Bill of Materials itself This in turn then specifies the (compatible) versions of the specific product SDKs.

How to fix com.android.support libraries version error when I add firebase libraries

when I try to insert libraries as indicated by firebase, and I try to Sync the project, i get this error:
This support library should not use a different version (26) than the compileSdkVersion (27) less... (Ctrl+F1)
Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).
I tried to follow some guides (https://firebase.google.com/docs/android/setup?authuser=0) and past answers of this problem, but the error persists
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.3'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.google.firebase:firebase-database:16.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'
}
apply plugin: 'com.google.gms.google-services'
Make sure that you are using the same API level 27, for 27.1.1 android support, from your app build.gradle:
android {
compileSdkVersion 27
defaultConfig {
.
minSdkVersion 15
targetSdkVersion 27
.
.
.
}
.
}
UPDATE
This may be caused by conflicts with the firebase versions. See this question.
Try to add this implementations on dependences, to fix this conflicts:
def android_api = "27.1.1"
implementation "com.android.support:appcompat-v7:$android_api"
implementation "com.android.support:animated-vector-drawable:$android_api"
implementation "com.android.support:exifinterface:$android_api"
implementation "com.android.support:cardview-v7:$android_api"
implementation "com.android.support:customtabs:$android_api"
implementation "com.android.support:support-media-compat:$android_api"
implementation "com.android.support:support-v4:$android_api"
Update:
implementation 'com.android.support:support-media-compat:26.1.0'
to the following:
implementation 'com.android.support:support-media-compat:27.1.1'
So, it can be the same version as appcompat-v7

How to resolve all google play-services dependencies with gradle?

Situation
Today, after touching nothing of the project, my gradle yelled at me and wouldn't compile the project. It failed to resolve firebase-iid, firebase-common, play-services-analytics-impl, play-services-auth-api-phone, and play-services-auth-base. So quite a mess after the weekend.
So I checked the versions of the different APIs, and upgraded the ones that needed upgrading, found out that Google had added a mandatory dependency to firebase-core, added it, then upgraded my google-services plugin, and even added a play-services-base dependency. I also upgraded firebase-messaging to version 17.0.0, and crashlytics to version 2.9.3.
But still, the build doesn't compile, with this error message:
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.
Gradle Files
Here is my Gradle file (showing dependencies part only), after my attempted fixes:
apply plugin: 'com.android.application'
...
dependencies {
implementation project(':library')
implementation project(':otherlibrary')
implementation 'com.android.volley:volley:1.1.0'
implementation('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
implementation 'com.google.android.gms:play-services-base:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:15.0.2'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation('com.google.android.gms:play-services-ads:15.0.1') {
exclude group: 'com.android.support', module: 'customtabs'
}
implementation 'com.google.android.gms:play-services-identity:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-drive:15.0.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:2.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.daimajia.slider:library:1.1.5#aar'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:mediarouter-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:exifinterface:27.1.1'
implementation 'com.android.support:support-v13:27.1.1'
// https://mvnrepository.com/artifact/com.darwinsys/hirondelle-date4j
implementation group: 'com.darwinsys', name: 'hirondelle-date4j', version: '1.5.1'
// For RxAndroid and RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
// Because RxAndroid releases are few and far between, it is recommended you also
// explicitly depend on RxJava's latest version for bug fixes and new features.
// (see https://github.com/ReactiveX/RxJava/releases for latest 2.x.x version)
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
// Crashlytics
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
// CSV with outputstream writer
implementation 'com.opencsv:opencsv:4.1'
// Gson
implementation 'com.google.code.gson:gson:2.8.5'
debugImplementation 'com.android.support.test:runner:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
androidTestImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And my project-wide gradle contain these lines:
...
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
...
}
dependencies {
...
classpath 'com.google.gms:google-services:4.0.1'
}
...
Official solution doesn't work
I already tried to fix the version number of multiple libraries according to the official firebase documentation, which is more or less the same as this question.
As you can read in the official documentation link, as of May 2nd, 2018, they offered a way to fix this kind of issue, but the numbers of the versions in question are not the same, and I already tried the given fix (with some downgrades now), to no avail.
Official documentation:
If your app has a dependency on com.google.firebase:firebase-core:15.0.0 as well as any of the following libraries:
com.google.android.gms:play-services-analytics
com.google.android.gms:play-services-appinvite
com.google.android.gms:play-services-tagmanager
com.google.firebase:firebase-analytics
com.google.firebase:firebase-crash
com.google.firebase:firebase-dynamic-links
com.google.firebase:firebase-messaging
You will need to update the version of the latter dependency to
15.0.2. This addresses the issue where version 3.3.0 of the Google Services Gradle plugin reports: The library
com.google.android.gms:play-services-measurement-base is being
requested by various other libraries at [[15.0.0,15.0.0],
[15.0.2,15.0.2]], but resolves to 15.0.2...
So how can I resolve these conflicts of versions in order for my build to compile once again correctly?
So after a day lost in this issue, I found out that the latest version of play-services-analytics is not the one they have published in their website. It is 16.0.0 and not 15.0.2.
Android Studio told that to a colleague as a warning, but mine was unconcerned about it. So here it is, the line that changes everything:
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
I added this to my build.gradle (application version) and it worked:
googleServices { disableVersionCheck = true }
(Keep in mind that this is just to disable the version check, it does not actually fix anything)
I tried reverting back to an old build, and it seemed to work, what i found was that the gradle-wrapper.properties was using and older version (4.5) instead of the 4.6 i had in the newer project. Changing this as well as reverting to classpath 'com.android.tools.build:gradle:3.2.0-alpha08' from alpha15 seemed to do the trick. I think you can use the alpha 15 if you like, but to be sure you can use the classpath 'com.android.tools.build:gradle:3.1.2'.
Along with all these changes the firebase-core and the google-gms-services should be set to version 16.0.0.
Unfortunately google play service has been stopped
This widows msg are generated &never run any google service performs

Error:Program type already present: android.arch.lifecycle.LiveData

When I press the run button in Android Studio, my app compiles but shows this error (redacted):
Error:Program type already present: android.arch.lifecycle.LiveData
(Full log)
I've tried deleting the .gradle folder, then going to Build > Clean Project and Build > Rebuild Project. However, it doesn't work. I've also tried deleting the source code, then cloning again from git and importing the folder to Android Studio. However, it still produces that error.
Here's my app's app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.edricchan.studybuddy"
minSdkVersion 24
targetSdkVersion 27
versionCode 8
versionName "1.0.0-rc.503"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
resConfigs "en"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:support-annotations:27.1.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
testImplementation 'junit:junit:4.12'
// Firebase stuff
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-firestore:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
implementation 'com.firebaseui:firebase-ui-firestore:3.1.0'
implementation 'com.firebaseui:firebase-ui-storage:3.1.0'
// Provide a way to update the app
implementation 'com.github.javiersantos:AppUpdater:2.6.4'
// Chrome Custom Tabs
implementation 'com.android.support:customtabs:27.1.0'
// The app's intro screen
implementation 'com.heinrichreimersoftware:material-intro:1.6.2'
// Use for new Material Text field boxes recently introduced
implementation 'com.github.HITGIF:TextFieldBoxes:1.3.7'
// Report an issue to Github without having to open a new tab and so on...
implementation 'com.heinrichreimersoftware:android-issue-reporter:1.3.1'
}
apply plugin: 'com.google.gms.google-services'
Apparently, this is intended behavior:
com.firebaseui:firebase-ui-firestore:3.1.0 depends on android.arch.lifecycle:extensions:1.0.0-beta1. Switching to version 3.2.2 fixes the issue by using the Lifecycle 1.1 libraries that Support Library 27.1.0 are built upon. - Issue Tracker
For me, removing the firebase-ui dependencies solved the issue since I wasn't even using the library in the first place.
I had the very same problem today when I raised the support library version.
Try to replace all '27.1.0' with '27.0.2'
Later on I did manage to remove the error by upgrading other libraries as well.
THis is my current working state:
root gradle:
buildscript {
ext.kotlin_version = '1.2.21'
ext.support_version = '27.1.0'
ext.anko_version = '0.10.4'
ext.android_plugin_version = '3.0.1'
ext.google_services_version = '11.8.0'
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
classpath 'com.android.tools.build:gradle:3.1.0-beta4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
//////////////////
app gradle libraries:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1#aar') {
transitive = true
}
// kotlin:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.anko:anko-common:$anko_version"
implementation "org.jetbrains.anko:anko-commons:$anko_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.3'
// support libraries:
implementation "com.android.support:recyclerview-v7:$support_version"
implementation "com.android.support:support-v4:$support_version"
implementation "com.android.support:design:$support_version"
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:cardview-v7:$support_version"
implementation "com.android.support:support-vector-drawable:$support_version"
// misc:
implementation 'com.github.d-max:spots-dialog:0.7#aar'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta5'
implementation 'com.backendless:backendless:4.4.0'
implementation 'io.nlopez.smartlocation:library:3.3.3'
// Google services:
implementation "com.google.firebase:firebase-core:$google_services_version"
implementation "com.google.firebase:firebase-auth:$google_services_version"
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
implementation "com.google.android.gms:play-services-location:$google_services_version"
implementation "com.google.android.gms:play-services-auth:$google_services_version"
implementation('com.google.api-client:google-api-client:1.23.0') {
exclude group: 'com.google.code.findbugs', module: 'jsr305'
}
}
///////////////
I also upgraded graddle-wrapper.properties to:
#Wed Dec 20 15:08:34 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
This post is the top search result for the very similar error: "Program type already present: android.arch.lifecycle.ViewModelProvider$Factory"
My project uses Room and LiveData, but not firebase. The following changes removed the error:
FROM:
implementation 'android.arch.persistence.room:runtime:1.0.0'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0'
implementation 'android.arch.lifecycle:extensions:1.0.0'
annotationProcessor 'android.arch.lifecycle:compiler:1.0.0'
TO:
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
--- UPDATED ANSWER ---
My previous answer was aimed at solving this error. However, I thought it would be worth presenting it again using best practises:
App level build.gradle file:
// Room components
implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
androidTestImplementation "android.arch.persistence.room:testing:$rootProject.roomVersion"
// Lifecycle components
implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"
Project level build.gradle file:
ext {
roomVersion = '1.1.1'
archLifecycleVersion = '1.1.1'
}
Reference:
https://codelabs.developers.google.com/codelabs/android-room-with-a-view/#2
Firebase-UI 3.1.0 isn't compatible with Firebase / Google Services 11.8.0
You will need to upgrade or downgrade according to https://github.com/firebase/FirebaseUI-Android#compatibility-with-firebase--google-play-services-libraries
Firebase-UI 3.1.0 with Firebase / Google Services 11.4.2
Firebase / Google Services 11.8.0 with Firebase-UI 3.1.3
Hope this help ;)
I also had the error posted in the original question, namely:
Error:Program type already present: android.arch.lifecycle.LiveData
It wasn't clear which libraries were causing the problem. With a hint from #lienmt above I realized that it may be related Firebase.
In my case, I am using Firebase and was also using firebase-ui library 3.2.2:
implementation 'com.firebaseui:firebase-ui-database:3.2.2'
I had upgraded all my other Firebase libraries to 15.0.0 but realized my firebase-ui library was incompatible and confirmed it here:
https://github.com/firebase/FirebaseUI-Android#compatibility-with-firebase--google-play-services-libraries
Be sure to match your firebase-ui version to the exact Firebase versions that for which they are fixed for pairing.
Bumping my firebase-ui version to 3.3.1 was what resolved the error:
implementation 'com.firebaseui:firebase-ui-database:3.3.1'
For reference here are the versions I'm using now and my app is running with no errors:
implementation 'com.google.android.gms:play-services-wearable:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'
implementation 'com.firebaseui:firebase-ui-database:3.3.1'
Please add following dependencies in your app build.gradel file
implementation "android.arch.core:runtime:1.1.1"
implementation "android.arch.core:common:1.1.1"
#Edric: since I couldn't replay with images in the thread I am answering your question here.
Changes that worked for me:
PS: I also upgraded distributionUrl in gradle-wrapper.properties to
http://services.gradle.org/distributions/gradle-4.6-all.zip
Like Edric mention, this happens because some library still use the old version of android.arch.lifecycle:extensions library, that is android.arch.lifecycle:extensions:1.0.0.
One way to handle this is by forcing the app to use the same version of that library (and if we can, use the newest one).
There are two ways to do that:
Explicitly defined the library version that we want to use in our Gradle, under dependencies section.
implementation 'android.arch.lifecycle:extensions:1.1.1
or
Force resolution of the library, also under dependencies section.
android {
configurations.all {
resolutionStrategy.force 'android.arch.lifecycle:extensions:1.1.1'
}
}
In my case, bumping targetSdkVersion and compileSdkVersion to 28, as well as using version 28 of all support libraries fixed the issue.
I encountered this when I upgraded Glide. I got an error regarding a duplicate CoordinatorLayout. I solved that by using com.android.support:design:27.1.0, but then I got another error regarding LiveData$LifecycleBoundObserver.
After a few hours, I gave up and upgraded targetSdkVersion and compileSdkVersion to API 28, as well as using
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
because YOLO. By dumb luck, it worked.
Just gotta upgrade. For me I had to upgrade the following in App build.gradle file:
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.firebaseui:firebase-ui-database:3.2.2'
Then you will sync your files. When you run you will get a new issue of installation failed pop up boxes. Just cancel those and do the following:
1) Build -> Clean Project
2) Build -> Build Bundle(s) / APK(s) -> Build APK(s)
3) Run your project! Should work!
Follow this link if you want any other details on how I solved it but this should do the trick!

Class file for com.google.android.gms.internal.zzaja not found

I am using Fragment for the designing of the Firebase simple login registration.
I get error in the OnCreateView() method on initializing
auth = FirebaseAuth.getInstance();
error:- Error:(58, 28) error: cannot access zzaja
class file for com.google.android.gms.internal.zzaja not found
please help
source:- http://www.androidhive.info/2016/06/android-getting-started-firebase-simple-login-registration-auth/
I solved this exact problem today and stumbled onto this unanswered question by chance during the process.
First, ensure you've properly setup Firebase for Android as documented here: https://firebase.google.com/docs/android/setup. Then, make sure you are compiling the latest version of the Firebase APIs (9.2.0) and the Google Play Services APIs (9.2.0) that you are using. My gradle dependencies look something like this:
dependencies {
...
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.google.firebase:firebase-auth:9.2.0'
compile 'com.google.firebase:firebase-messaging:9.2.0'
}
Hope this helps!
I had such a similar error when i was recently upgrading my play service dependency. It seems to occur when you leave out updating the firebase dependencies that correspond to the version of play services you use. I beleive this is the most recent update of these dependencies
Here is what the two versions of my dependencies were:
Error version of dependencies
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.firebase:firebase-auth:9.8.0'
compile 'com.google.firebase:firebase-database:9.8.0'
compile 'com.firebaseui:firebase-ui-database:1.0.1'
compile 'com.google.firebase:firebase-storage:9.8.0'
Working version of dependencies
``
compile 'com.google.firebase:firebase-appindexing:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
compile 'com.google.android.gms:play-services-places:10.0.1'
compile 'com.google.android.gms:play-services-location:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.0'
compile 'com.google.firebase:firebase-database:10.0.0'
compile 'com.firebaseui:firebase-ui-database:1.0.1'
compile 'com.google.firebase:firebase-storage:10.0.0'
``
Google seems to move play service updates along with firebase updates these days. Hopes this saves a few souls out there.
If you use different version of play services libraries, you will get this error.
For example, below entries in build.gradle file cause the error as versions are different.
implementation 'com.google.android.gms:play-services-maps:11.4.2'
implementation 'com.google.android.gms:play-services-location:11.6.0'
To fix the issue use same versions.
implementation 'com.google.android.gms:play-services-maps:11.6.0'
implementation 'com.google.android.gms:play-services-location:11.6.0'
All your firebase version should be with same Version whatever it
like this
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-database:9.0.0'
compile 'com.google.firebase:firebase-auth:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
Well, the short answer is: update your library version. Android studio will tell you that there is a new version of it with a message like:
A newer version of com.google.firebase:firebase-core than 14.0.4 is
available: 16.0.4
Just move to that line, press Alt + Enter and select Change to X.X where X.X is the newer version.
This way, you can update all your libraries. Repeat the process with all the libraries and you are done.
If you are using more than one libraries of firebase then make sure that the version are same.
Before:
compile 'com.google.firebase:firebase-database:9.2.0'
compile 'com.google.firebase:firebase-storage:9.2.0'
compile 'com.firebaseui:firebase-ui-database:0.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-auth:9.0.2'
After: compile 'com.google.firebase:firebase-database:9.2.0'
compile 'com.google.firebase:firebase-storage:9.2.0'
compile 'com.firebaseui:firebase-ui-database:0.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-auth:9.2.0'
in my case i have used auth with 9.0.2 .So i changed to 9.2.0
I solved the problem in june of 2017 changing the play-services versions for the latest firebase versions (9.6.1). When I used the latest play-services version (10.2.4) I got that error. The code in the gradle looks like this:
Before
compile 'com.google.android.gms:play-services-maps:10.2.4'
compile 'com.google.android.gms:play-services-places:10.2.4'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-auth:9.6.1'
After
compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'com.google.android.gms:play-services-places:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-auth:9.6.1'
play services, firebase, gradle plugin latest version combination that worked for me.
try app module build.gradle
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "my package name"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
publishNonDefault true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
} }
dependencies {
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-vision:15.0.2'
implementation 'com.google.android.gms:play-services-analytics:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-iid:17.0.0'
implementation 'com.google.firebase:firebase-messaging:17.3.0'
implementation 'com.google.firebase:firebase-crash:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
And project level build.gradle like this
buildscript {
repositories {
maven { url 'https://maven.google.com' }
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.1.0'
}
}
I have a also same problem.Change old version of FirebaseAuth to newer version. for me I change "com.google.firebase:firebase-auth:11.4.0" to "com.google.firebase:firebase-auth:11.8.0"
As stated in the Google documentation, Add the latest version of the Google Service plugin (4.0.1 on 06/04/18). Hope this hepls!
buildscript {
// ...
dependencies {
// ...
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
}
}
`
Do not mix 12 and 15, use this
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
Same problem occurred with me. By updating library to latest one will resolve this problem.
After updating don't forget to do Sync project with gradle files.
Use:
compile 'com.google.firebase:firebase-auth:11.0.4'
This works.
You can easily solve this problem by getting the latest version of the Firebase Libraries for Android SDK.
You can get the latest library from https://firebase.google.com/docs/android/setup
Example:
Before:
implementation 'com.google.firebase:firebase-auth:10.6.0'
to
After:
implementation 'com.google.firebase:firebase-auth:16.0.4'
Just make sure all the implementations of firebase you are using have the same version inside the dependencies in build.gradle (app).
Just Simply Add this two dependency to your pubspec.yml. this works for me.
firebase_messaging: ^5.0.1
firebase_core: ^0.3.0
This error occurs only due to the difference in version. Whenever this kinda error occurs try to change the SDK versions, Gradle Build versions, or dependency version.
If you are using
targetSdkVersion = 26
compileSdkVersion = 26
'com.android.tools.build:gradle:3.6.3'
then add this version for firebase dependencies.
implementation 'com.google.firebase:firebase-core:11.6.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'
It works.

Categories

Resources