Updated Android Studio - Firebase Auth Fails - android

Everything worked before I updated Android Studio, Android Support Repository, Google Play Services, and Google Repository today. Now I can't get past my login screen. As I mentioned in the title, I'm using Firebase for authentication and data storage.
I'm also using an emulator: Nexus 6p API 23
Here's the error that I get when I try to sign in
03-05 13:39:50.689 2790-2852/alodia.medremind W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
03-05 13:39:50.698 2790-2852/alodia.medremind W/GooglePlayServicesUtil: Google Play services out of date. Requires 10298000 but found 10084470
Here's my project build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here's my app build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "alodia.medremind"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.github.paolorotolo:appintro:4.1.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.firebase:firebase-core:10.2.0'
compile "com.google.firebase:firebase-auth:10.2.0"
compile "com.google.firebase:firebase-database:10.2.0"
compile "com.google.firebase:firebase-storage:10.2.0"
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'org.parceler:parceler-api:1.1.1'
compile 'com.android.support:support-v4:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
testCompile 'junit:junit:4.12'
apt 'org.parceler:parceler:1.1.1'
}
apply plugin: 'com.google.gms.google-services'
It'd be great to be able to fix this issue, but I mostly want to know the why behind this problem. I'm fairly new to Android and I'm sure that I misunderstand a lot of basic concepts.

clean your project and rebuild, if not worked then you can refer to this post.

Your google play service must be in version 10.2.0 or higher :
'com.google.gms:google-services:10.2.0'

Your emulator system image does not have the latest revision (10.2.98) of Google Play Services.
From Android Studio, open the SDK Manager and check the Show Package Details box. Because you are testing with an API 23 image, scroll down to the section for Android 6.0. Update the emulator images with names of the form Google APIs ... System Image. The latest is Rev 20.
When you run the emulator, you can confirm you have the latest version by going to Settings > Apps, scrolling to Google Play Services, and clicking to see the version number in the App Info.

I solved this problem by updating Google Play Services in the phone from 8.0 to 11.0.

i just solved my problem bro, i think you just need re-sync the firebase, follow this step click tab Tools -> firebase -> choose 1 of the firebase feature -> if the button connected is in the gray color, you have to re-sync the firebase, it will update the firebase configuration to the latest version. hope it will help.

make sure that you have added firebase authentication to your project after you connected the project to firebase.

Related

Android Studio Gradle Sync Error using google play-services-maps 11.6.2

I am developing a google map app using Android Studio. When I sync the project with Gradle Files (Select Tools/Android/Sync Project with Gradle Files on Android Studio), I get the following error:
Could not resolve com.google.android.gms:play-services-maps:11.6.2.
Couold not get resource 'https://dl.google.com/dl/android/maven2/com/google/android/gms/play-services-maps/11.62./play-services-maps-11.6.2.pom
This is the software I am using:
Android Studio 3.0.1
Android Version 7.1.1
Google Play Services 46
Google Repository 58 (under Support Repository)
I've tried using both the google maps project template and the empty activity project but I get the same error.
I am using the http proxy setup I used from earlier projects. I am able to install the play-services-maps and the google repository.
I also added the maven url to the Gradle Project file in the All Projects/Repositories section.
I have tried the suggestions from Stack Overflow but none have not worked.
Any ideas?
Gradle Project Build file:
// 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.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The gradle app build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "hansen.scott.googlemaps"
minSdkVersion 25
targetSdkVersion 26
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:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-maps:11.6.2'
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'
}
The error is in the line:
implementation 'com.google.android.gms:play-services-maps:11.6.2'
try adding this in project level gradle file
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
}
}
Someone had the same issue I did and entered it on Stack Overflow a day or two ago. The user was getting a build error when using player-services-maps 11.6.2. If the user changed the version to 11.0.0, the build succeeded.
Once I back-dated the maps version to 11.0.0, this solved my problem too. I created a new Google Map project and didn't modify the Gradle Build files.
The problem appears to be that play-services-maps won't build using a versions after 11.0.0. I will post the issue on Github.
Thank you for everybody's help.
I have been facing the same issue for the past one week and posted it on Stack Overflow as well but to no effect.
I have since then figured out the root cause. I am working out of my office and thus have firewalls in place. I got it checked with the system admin and on turning off the firewall the build worked.
So i would advice you to have this checked as well.
Kind regards,
Kabir

Installing Google Play Services [duplicate]

This question already has answers here:
Failed to resolve com.google.android.gms play-services-auth:11.4.0
(13 answers)
Failed to resolve: com.android.support:cardview-v7:26.0.0 android
(26 answers)
Failed to resolve: com.android.support:appcompat-v7:26.0.0
(14 answers)
Closed 5 years ago.
I want to use location APIs with Google Play Services
This is top-level gradle file :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and this is my app-level gradle file :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "..."
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
// exclude group: 'com.android.support', module: 'support-annotations'
// })
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.google.android.gms:play-services:11.4.2'
}
When I want to build the project, this error shown :
Error:(30, 13) Failed to resolve: com.google.android.gms:play-services:11.4.2
Install Repository and sync project
Show in File
Show in Project Structure dialog
I have Installed Google Play Services By Clicking on "Install Repository and Sync Project" but the error still shown
According to this documentation :
https://developers.google.com/android/guides/setup
I have replaced google-play-services dependency with this lines :
compile 'com.google.android.gms:play-services-location:11.4.2'
compile 'com.google.android.gms:play-services-maps:11.4.2'
When I build project, "Failed to resolve ... " error shown but when I click on "Install Repository and sync project" nothing happened !
What is the problem ? There is problem on version numbers ? or something else ?!
From what is written HERE, to use google play services from version 11.2.0 your project compileSdkVersion must be set to, at least, version 26.
When you upgrade your app’s Play services dependencies to 11.2.0 or later, your app’s build.gradle must also be updated to specify a compileSdkVersion of at least 26 (Android O). This does not change the way your app runs. You will not be required to update targetSdkVersion.
Since your project is running on version 25, the max google play service version you can import in gradle is version 11.0.
compile 'com.google.android.gms:play-services-location:11.0'
You need to add the following to your project level Gradle file:
allprojects {
repositories {
maven { url "https:// maven.google.com" }
}
}
//This is when you are using a version of Gradle below 4.1.
Note - if you are following this, then you also need to downgrade your play services dependency version. A better way would be to update to latest compileSDKVersion

failed to resolve com.google.firebase:firebase-core:10.0.1

I want to use Firebase Cloud Messaging in my Android App.
This is my app level gradle file
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'androiddebugkey'
keyPassword 'android'
}
config1 {
keyPassword 'android'
}
}
compileSdkVersion 23
buildToolsVersion "23.0.3"
packagingOptions {
exclude 'main/AndroidManifest.xml'
}
defaultConfig {
applicationId "com.shikhar.dexter.project"
minSdkVersion 19
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
}
apply plugin: 'com.google.gms.google-services'
This is my root level gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application depndencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven{
url "http://dl.bintray.com/dasar/maven"
}
}
}
While compiling it shows these Errors:
Failed to resolve: com.google.firebase:firebase-core:10.0.1
Error:(36, 13) Failed to resolve: com.google.firebase:firebase-messaging:10.0.1
I tried with various Google Play Services Versions like 9.4.0 but still it doesn't work.
Open SDK Manager and make sure you have latest "Google Play Services" dependency downloaded.
In addition to downloading the latest "Google Play Services" as suggested by John Oreilly above I also had to update my 'Google Repository' to get it to work.
In Android Studio go to "Tools -> Android -> SDK manager". In the SDK manager select the tab "SDK Tools" and below "Support Repository" you find 'Google Repository', upgrade it if it's not using the latest version.
Probably needs an update of Google Play Services and Google Repository.
In Android Studio SDK Manager:
Select SDK Tools tab
Select and install Google Play Services
and Google Repository
Sync and Build
see screenshot
Try adding all the google dependencies of same version and keep the "Google Play Services" updated in the SDK Manager.
compile 'com.google.firebase:firebase-appindexing:10.0.0'
compile 'com.google.android.gms:play-services-auth:10.0.0'
compile 'com.google.android.gms:play-services-places:10.0.0'
just had the problem, that with the update from Support Repository v44 to v45 (mid of March 2107); the repository location suddenly changed and therefore some dependencies broke, resulting in quite the same error message (the reason why I want to add this as a possible answer).
in the Project level build.gradle, the repository v44 was located at:
repositories {
maven { url '... /sdk/extras/android/m2repository' }
}
while in the meanwhile, the repository v45 is located at:
repositories {
maven { url '... /sdk/extras/m2repository' }
}
in order to refresh and to get debug information:
./gradlew clean --debug
even with other versions of the repository, it may help to browse the directory structure and compare the location of the repository with the location referenced in the build.gradle, which is supposed to host these dependencies.
I Solved this problem in my computer(I use Intelij)
what I did is:
1)Go to tools-> SDK manager and update the google play serve and the google repstories.
2)add to the build this maven { url "https://maven.google.com" }under allprojects->repstories

I cannot get firebase crash report working on Android

Here are my build.gradle files.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'com.google.gms:google-services:2.1.2'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is another one
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId 'com.example.app'
minSdkVersion 15
targetSdkVersion 24
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 {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
//compile 'com.google.firebase:firebase-core:9.8.0'
compile 'com.google.firebase:firebase-ads:9.8.0'
compile 'com.google.firebase:firebase-crash:9.8.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha9'
compile project(path: ':standOut')
}
apply plugin: 'com.google.gms.google-services'
Gradle Sync goes normally, but when I try to run the app I get the following error
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/measurement/AppMeasurementService.class
If I change the line classpath 'com.google.gms:google-services:2.1.2' to classpath 'com.google.gms:google-services:3.0.0' and sync gradle files I can run the app, when I run it on a real device I get this error.
E/FirebaseCrash: Failed to initialize crash reporting: com.google.android.gms.internal.zztl$zza: No acceptable module found. Local version is 0 and remote version is 0.
When later I do something to crash my app on purpose I don't get any crash report. But when I run the same app on Samsung Galaxy S3 Mini and crash my app I do get a crash report.
On first device play services version is 9.4, on Samsung it's 9.8.
Why when I use version 3.0.0 of google services plugin it works on Samsung and does not work on other devices (I tried to run the app on two other devices and it didn't work on either of them)?
Why do I get this duplicate entry error when I use plugin version 2.1.2?
Also, I checked versions of plugin on jcenter and version 2.1.2 is dated 3 Jun, 2016 and 3.0.0 is 18 May, 2016 (https://bintray.com/android/android-tools/com.google.gms.google-services). So, which version is the latest and which version should I use?
Do you think I need this line compile 'com.google.firebase:firebase-core:9.8.0'. I tried to do with and without it, it does not seem to make any difference.
It turns out that the google play services version on the devices cannot be lower than the version of the library used. The google services plugin downloaded version 9.8. On Samsung I have version 9.8 and crash reporting works, but on other devices I have version 9.4 and it didn't work. IMHO it's wrong, because that means that I will not get crash report from the users who have google play services version lower than 9.8.
I tried to find a way to make firebase crash reporting work with plugin version 2.1.2, as I couldn't do that I used version 3.0.0. It seems like version 3.0.0 is the way to go, I just wonder why the latest version is 2.1.2.
As I switched to version 3.0.0 and updated play services to version 9.8 on the device everything worked.

Getting .dex 64K error on a small app that works fine on a different PC

I've recently started a new Android Studio project on one PC (very barebones: 3 Activitys, 1 Fragment, all very basic at this stage), and uploaded it to Version Control System through Android Studio (I assume it will only add the necessary files).
When I checkout the project on a different PC, Android Studio recognizes it is a project, and offers to open it as one. The gradle build completes, but on attempting to run the app on a device or emulator, I get the old problem:
Error: The number of method references in a .dex file cannot exceed 64K.
The only dependency as such is the 'bluealliance spectrum color picker', which I have used in the past without issue. I would assume that it has built something wrong, but considering everything is identical to the original project I can't see how it's going wrong - or how it could possibly have >64K methods.
Below are the gradle files:
mobile build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.aetherum.timetableapp"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "http://github.com/wada811/Android-Material-Design-Colors/raw/master/repository/"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.thebluealliance:spectrum:0.6.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:preference-v7:23.2.1'
compile 'com.android.support:preference-v14:23.2.1'
compile 'com.wada811:android-material-design-colors:2.0.0'
}
And the project build.gradle :
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried cleaning and rebuilding the project, as well as checking it out again from git. At this stage, as an inexperienced developer, I'm out of ideas.
The only dependency as such is the 'bluealliance spectrum color picker',
No, you have at least seven dependencies, not including any JARs that might be in libs/.
One of those dependencies is play-services. Unless you are using every single API in the Play Services SDK, you will be much better off using more granular dependencies (e.g., play-services-maps for Maps V2), to pull in only those bits of Play Services that you need.
BTW, you should change your 23.2.1 dependencies to 23.4.0, so all your Android Support Library dependencies are from the same version.
Please remove this line of code
compile 'com.google.android.gms:play-services:9.4.0'

Categories

Resources