Google Play services out of date. Requires 11910000 but found 11577470 - android

I'm trying to include Firebase in my Android project. Running it, throws me this error:
Google Play services out of date. Requires 11910000 but found 11577470
I found several links about this here, most of them saying to downgrade to:
compile 'com.google.android.gms:play-services:9.6.0'
This doesn't work for me anymore, because I use SDK 26 and it throws incompatibilities errors with other libraries.
Here are my gradle files:
(Module):`
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.1.1'
}
`App:
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.project"
minSdkVersion 24
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-messaging: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'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.android.gms:play-services:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
And as you can see here my Google Services is updated as well.
In my log I get these errors:
I/FirebaseCrash: Sending crashes
W/FirebaseInstanceId: No response
E/FirebaseInstanceId: Topic sync failed: TIMEOUT
E/FirebaseInstanceId: Topic sync failed: SERVICE_NOT_AVAILABLE
W/FirebaseInstanceId: No response
E/FirebaseInstanceId: Topic sync failed: TIMEOUT
Does anyone know how I could resolve this problem? Any tips are appreciated. Thanks.

I had the same issue, and had to move down to API 21 emulator image with google apps. That one is more up to date, and works.

It means that the Play Services APK on your device is older than the version you requested in your app.
If this is an emulator, you'll want to use the ones with "Google Play" in their names, not "Google APIs." The latter are always behind schedule and require a full image update to get the latest Play Services version whereas the former give you the Play Store which will update Play Services for you. If this is a device, make to update this app.
BTW, you should be showing a notification or dialog in your app if Play Services isn't available. See how to check for availability.

Related

Gradle sync failed due to "Unable to resolve dependency" error

I suddenly get this error and I don't know how to resolve this. I already tried all suggestions here Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve but nothing worked for me.
What I already tried:
updated my sourceCompatibility and targetCompatibility from 1.7 to JavaVersion.VERSION_1_8 as it was suggested to me
Deleted the .idea folder
deleted google-services plugin, implementation 'com.google.android.gms:play-services-auth:17.0.0' in .gradle (app) and google services class path in .gradle (project) --> error still occurs
When I update the google-services class path in the project file to the newest version 4.3.2 I get this error
deleted the google-services.json and downloaded a new one
Could not resolve com.google.gms:google-services:4.3.2.
...
Remote host closed connection during handshake
I invalidated Cache/restart
In the SDK manager the Android SDK is displayed as partially installed --> click on show Package details --> nothing to install, everything is shown as installed
in the misc.xml file the language level has been updated from JDK 1_7 to 1_8
Here is maybe also a problem I am facing right now which can be cause of this problem:
Previously I had the SDK 29 installed but in the SDK manager it was shown as "partially installed" but when I clicked on "Show package details" there was nothing to install. I wanted to reinstall Android 10 so I deleted it first but now I am unable to reinstall it again because it is not shown anymore in der Android SDK manager. Where can I find it again?
Under SDK Platforms there are only the installed SDKs not all SDKs I can install, is this the right behavior?
Also under "SDK Updates Sites" I get an error with the "Android Repository" under "Enabled" --> red sign with the message "IO exception while downloading manifest"
Here is the problem I currently get in Android Studio:
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-base:[17.2.0].
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.google.android.gms:play-services-measurement-impl:[17.2.0].
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-gass:[18.2.0].
Show Details
Affected Modules: app
...
Here is my build.gradle (Project):
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.firebase-perf'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.android.guessit"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
//Firebase SDKs
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-ads:18.2.0'
implementation 'com.google.firebase:firebase-perf:19.0.0'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation "androidx.lifecycle:lifecycle-extensions:2.1.0"
//Glide maybe later add code to proguard
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
// Circle ImageView
implementation 'de.hdodenhof:circleimageview:3.0.1'
// CardView and GridLayout
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
// Facebook SDK and login
implementation 'com.facebook.android:facebook-login:4.41.0'
//image downloading and caching library for Android
implementation 'com.squareup.picasso:picasso:2.71828'
}
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
How can I resolve this?
In your project build.gradle, place google() above mavenLocal() as per below:
...
allprojects {
repositories {
google()
jcenter()
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
}
...
I just restarted my computer and it is now working as expected. Also the "IO exception" under the SDK updates sites is not displaying anymore. I think the problem was that this caused all the errors as seen in my post. I also changed the HTTP Proxy under the System Settings to "Auto-detect proxy settings". Also Kaspersky was not running in the right way so after restart it was working fine again, this could also be the solution to my described problem.
Edit:
The error has come two days after I managed to make it work again so the above mentioned solution might not be the one that helped me solving this issue. After having this problem again I tried the above steps again but nothing worked so I invalidated the cache and restarted android studio and it worked again for me.

Android WebView not finding TracingController

I'm trying to write a simple app with a WebView, but when I create a WebView I get an error:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/webkit/TracingController;
I searched and found that TracingController is implemented from api level 28, but I only have 27.
How can I resolve this?
Might be late but helpful if someone has the same issue.I had same issue on my project and I figured out that issue is with the SDK version 28.
- If you use the below sets of dependencies then you will not have this issue.
compileSdkVersion 27
buildToolsVersion '28.0.3'
minSdkVersion 16
targetSdkVersion 26
Also, I have included the dependencies used in my project. I have used MoPub SDK for Ads and Google AdMob & Facebook mediation adapters.
compile "com.android.support:appcompat-v7:27.1.1"
compile "com.android.support:design:27.1.1"
compile 'com.android.support.constraint:constraint-layout:1.1.3'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true
}
compile 'com.android.support:multidex:1.0.3'
compile "com.google.firebase:firebase-core:16.0.1"
compile "com.google.firebase:firebase-ads:15.0.1"
compile "com.google.android.gms:play-services-analytics:15.0.0"
compile "com.google.firebase:firebase-config:15.0.0"
compile 'com.google.android.ads.consent:consent-library:1.0.6'
// Glide
compile 'com.github.bumptech.glide:glide:3.7.0'
/* Mopub SDK */
compile('com.mopub:mopub-sdk:5.3.0#aar') {
transitive = true
}
compile 'com.mopub.mediation:admob:15.0.0.11'
compile 'com.mopub.mediation:facebookaudiencenetwork:5.0.0.0'
compile 'com.facebook.android:audience-network-sdk:5.0.0'
same issue here, only appearing on Android 8 in ionic after building with --release. The app shows the splash screen and then is stuck in white screen

Google sign in button error in android studio

Situation:
I am trying to add Google SignIn button to my project using the Custom Google SignIn Button library like the one shown above:
Here is my build.gradle file:
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.android.support:design:26.1.0'
compile 'com.shobhitpuri.custombuttons:google-signin:1.0.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'
}
Problem:
I get the following error:
Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed : uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.shobhitpuri.custombuttons:google-signin:1.0.0]
C:\Users\durga rao.gradle\caches\transforms-1\files-1.1\google-signin-1.0.0.aar\4fa7da22804ff19ac92142afd0b85e2b\AndroidManifest.xml as the library might be using APIs not available in 15 Suggestion: use a compatible library with a minSdk of at most 15,or increase this project's minSdk version to at least 16, or use tools:overrideLibrary="com.shobhitpuri.custombuttons" to force usage (may lead to runtime failures)
Initial solution:
From the tags on the question, it looks like you are using Android Studio 3.0, which uses Gradle 3.0 and above. One of the breaking changes with Gradle 3.0 plugin based on Use the new dependency configurations
documentation is that the compile keyword has been replaced with implementation. So for adding Custom Google SignIn Button library, instead of compile keyword with the library use:
implementation 'com.shobhitpuri.custombuttons:google-signin:1.0.0'
Update:
Based on the error you mentioned, it seems in your project's build.gradle, your minSdkVersion is set to 15. The Custom Google SignIn Button library supports minSdkVersion of 16 since based on Platform Version Distribution Chart, 99.3% of the Android devices in the world are running API 16 and above. Changing your projects minSdkVersion to 16 should solve the issue. Hope this helps.
Disclaimer: I am the author of the library. Please let me know if you face any issues. Would be happy to help.

Updated Android Studio - Firebase Auth Fails

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.

What are the necessary gradle dependencies for an App Engine Backend with Google Cloud Messaging?

What are the necessary gradle dependencies for an App Engine Backend with Google Cloud Messaging?
Currently, when you add a module like that to your Android Studio project it adds this dependency:
'compile 'com.google.android.gms:play-services:8.4.0'
However, when you run the project you get this error:
Error:Execution failed for task
':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java''
finished with non-zero exit value 2
Someone suggested using this:
defaultConfig {
multiDexEnabled true
}
But that actually didn't work for me.
So it appears that I have to specify only the required libraries for GAE + GCM. So far I have:
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-base:8.4.0'
full list here. But that didn't work. I got this error:
E/GMPM: GoogleService failed to initialize, status: 10, Missing an
expected resource: 'R.string.google_app_id' for initializing Google
services. Possible causes are missing google-services.json or
com.google.gms.google-services gradle plugin.
So I am at a loss.
Is there some other way around this issue? What is weird is my old GAE + GCM projects work fine importing the whole google play services. Importing those older versions of google play services in my new project does not work however. So I am not sure what is going on.
EDIT: Some more information:
I did some tests.
1) Started new Android Studio project, added new google cloud module 'App Engine Java Endpoints Module'. The auto-generated build.grade (Module: app) looks like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile project(path: ':backend', configuration: 'android-endpoints')
}
Result? Compiles and runs perfectly - no problems!
2) Started new Android Studio project, added new google cloud module 'App Engine Backend with Google Cloud Messaging'. the auto-generated build.grade (Module: app) looks like this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile project(path: ':backend', configuration: 'android-endpoints')
}
Result? Same crappy error I have been getting!
So it looks like the line 'compile 'com.google.android.gms:play-services:8.4.0'' is the problem. I replaced it with
'compile 'com.google.android.gms:play-services-gcm:8.4.0''
since in theory that is all I need for google cloud messaging. When I run it I get this:
12-30 14:14:16.482 10573-10573/com.myapp.myapp
E/GMPM: GoogleService failed to initialize, status: 10, Missing an
expected resource: 'R.string.google_app_id' for initializing Google
services. Possible causes are missing google-services.json or
com.google.gms.google-services gradle plugin. 12-30 14:14:16.482
10573-10573/com.myapp.myapp E/GMPM: Scheduler not
set. Not logging error/warn. 12-30 14:14:16.502
10573-10623/com.myapp.myapp E/GMPM: Uploading is
not possible. App measurement disabled
So it looks like I am missing this google-services.json file or something. I don't get what happened with Android Studio because several months ago I made a GCM enabled app the same way and that one compiles no problem. The gradle.build file of that app looks like this:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(path: ':gcm-backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.ganyo:gcm-server:1.0.2'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:support-v4:22.2.0'
}
So it looks like Android Studio stopped adding the 'compile 'com.ganyo:gcm-server:1.0.2'' dependency.
So I ran a project with
'compile 'com.ganyo:gcm-server:1.0.2'
'compile 'com.google.android.gms:play-services:8.4.0'
Result? Same Execution failed error.
Ok so let's try the old play-services library in my new project:
'compile 'com.ganyo:gcm-server:1.0.2'
'compile 'com.google.android.gms:play-services:7.5.0'
Result? Same Execution failed error.
I just don't get why this isn't working out of the box like it used to...
So, this should be considered an issue with Android Studio since simply adding a module 'App Engine Backend with Google Cloud Messaging' will break the build every time on even the simplest of apps, due to the full Google Play Services dependency 'com.google.android.gms:play-services:8.4.0' being large enough to exceed the 65K DEX method limit on its own. This problem is actually documented in 'Setting Up Google Play Services'.
The solution is, as you had discovered, to manually edit your build.gradle and add only the import for GCM 'com.google.android.gms:play-services-gcm:8.4.0'. The requirement for 'google-services.json' to be added manually is normal though, since you need to generate it for your project on developers.google.com. Adding 'multiDexEnabled true' isn't a good solution, as it increases your APK size needlessly, and you still end up with duplicate dependencies.
I've created an entry on the Android issue tracker to fix the dependencies for the App Engine GCM backend module in Android Studio. Feel free to star this issue for visibility and updates.
Preliminary tests show that this works so far.
I took at a look at the google GCM sample project here: https://github.com/googlesamples/google-services/tree/master/android/gcm
And edited my gradle files. Here is what they look like now:
APP:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.me.myapp"
minSdkVersion 13
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-gcm:8.4.0'
testCompile 'junit:junit:4.12'
compile project(path: ':backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
apply plugin: 'com.google.gms.google-services'
PROJECT:
// 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:1.5.0'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
// 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 also I followed this guide (see step 2) to generate a google-services.json file which I dropped into the app/ directory.
Now the app compiles and works (so far at least).
I'm really angry this doesn't work out of the box with the auto generated gradle files and that I have to hunt them down in some sample app. It didn't used to be this way just a few months ago. It worked as soon as you added the GCM module.
If anyone else has any tips/suggestions for future projects please let me know. =D
If you do get to the stage where you need to run with MultiDex enabled, there are three steps you need to do:
Enable it in your defaultConfig in Gradle as you already tried:
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
Include it in your dependencies:
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
Add it to your manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
https://developer.android.com/intl/es/tools/building/multidex.html#about
But always have a good look at the dependencies you already have as it's usually not needed.

Categories

Resources