App wont run unless you update google play services - android

Whenever I run my app in my emulator, which uses the Google maps API, I get the error "App wont run unless you update google play services". I've digged through some other questions about the same topic here on SO, since there are many, but I did not find a solution yet. So how do I get the Google maps API to work on my emulator?
When I go through installed apps on the emlator I don't see Google Play services in the list. So I am guessing this is the problem? If so, how do I get this on my device? Or isn't it possible at all on an emulator to use Google Play services?
I am using an emulator with Google API enabled.
Here is my Gradle build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.thomas.app"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:design:23.0.1'
}

I had this same problem. I opened my emulator, went to Settings -> Apps -> Google Play services, and noted the version (in my case, 8.1.65). Then I opened my build.gradle and saw that the version there for com.google.android.gms:play-services was 8.3.0. I changed it to 8.1.0 and it worked on the emulator.

You might have to do a check in your code if the user has Google play services installed. If they dont, prompt them to download it from the play store.

So There was no way to make Google play services run the default Android emulator shipped with the SDK . So instead I started to look into other emulators and found xamarin android player. I got Google play store and Google play services working on it in no time. So if anyone also has this issue, use this emulator instead. The only downside is you can't debug in it.

I got around this limitation of Android emulators by using Samsung's Device Test Lab - http://developer.samsung.com/remotetestlab. You can launch from a multitude of devices there, which all have Play Services.

Related

Android Studio 2.1.2 with Firebase NOT WORKING

whenever I try initiating firebase, there's always these errors
W/GooglePlayServicesUtil: Google Play services out of date. Requires 11020000 but found 8489470
W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
E/FA: Discarding data. Failed to send app launch
E/FA: Failed to get app instance id
E/FA: Failed to send current screen to service
E/FA: Discarding data. Failed to send event to service
I get it's something related to Google Play Services but I just cant figure out how to fix it, I'm running Android Studio 2.1.2 and there's no update for Google Play Services in the SDKs
EDIT: My App Gradle (I'm using an emulator)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.sc.voxcinemascamp"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.google.firebase:firebase-core:11.0.2'
}
apply plugin: 'com.google.gms.google-services'
So, it's clear now. You need either update your emulator to get Play Services 11 installed on it, or downgrade your firebase dependency to match Google Play Services installed on your emulator.
I would rather suggest to update emulator, don't downgrade Play Services used in your app because of emulator.
Uninstall your app on the emulator---go to home screen of your emulator---open google play and login with a gmail account---as soon as youve logged in,you will get a google play update popup or notification that says application will not launch until google play services is updated..follow the screen prompts to update google play,then run your application again.
Got same problem.The problem was in my emulator.Just upgraded my emulators google play services and it worked fine.Or try to run in another emulator which has upgrade version of google play services.

App wont open below lollipop versions

I am new to android development,
i have made one app which is working perfect on 5.0 and above. but when i tasted .apk with my other phone which is runnnig on micromax 4.4.2 os( 480x800) mobile, it installs but doesnt open. unfortunately app_name has been stop.
so i attatchd my microamx mobile to android studio and tried to run app. everything workd well. why it doesnt work when i shared .apk before??
please help.
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.kalpu.practice1234"
minSdkVersion 14
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
}
This issue is caused by Instant Run. It is not the problem of gradle.
Instant Run will generate the .apk for a specific device and if you use the same .apk for another device it will not work.
If you want to run the same .apk on another device then disable Instant Run and build.
Try below things:
Turn off Instant run from android studio like below.
Then clean project and rebuild it.
Then Run it.
If still you getting problem then post your logcat error.
I wouldn't turn off a useful feature (Instant run)
Generating the signed version just for this can be overkill, especially if it's a new project that hasn't been signed yet.
Simply use the Build APK menu item from the Build menu.
You will get a small popup with a link to open the generated APK in the file manager:
Note: the screenshots are taken in Android Studio 2.2 running in Windows 10.

Android app backward compatible version of google play services API

when I deploy my android app on android mobile version 4.4 (lollipop), I am getting a message that "app won't run unless you update Google play services"
I looked at my android mobile and can see that Google play services version is 5.1.89. I know in my code I am using 8.4.0
I don't want android to show popup to user to update google play services
can any android mobile app expert help me fix this issue.
how do I make my app backward compatible without asking user to update google services?
my build.gradle is as follows
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
buildTypes {
debug {
debuggable true
}
}
defaultConfig {
applicationId "com.me"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
}
As described in the Google Play Services overview, the service consists of two parts: the client library that is linked into the application at build time, as well as the Google Play services APK, to which the client library connects using inter-process communication (IPC).
You generally only need to upgrade the client library if you wish to use new features of Google Play Services or if you're hit by a bug that is fixed in a later release.
The Google Play services APK runs as a background service that provides the actual Google services to your application. With this split model, Google can promptly push out new features, service updates and critical bug fixes to end-user devices without needing to wait for carriers or device manufacturers to implement these fixes.
As a consequence, the Google Play services APK has to be backwards compatible with previously released versions of the client library to avoid breaking developer's applications each time it is updated.
The opposite, however, is not true. If you build your application using a specific version of the client library the installed Google Play services APK version must not be older than that.
So if you build against library version 5.1.89 your app will work with version 8.4.0 of the APK, but won't if the installed version is, e.g., 5.0.0.
A well behaved application always checks the availability and version of the installed Google Play services APK before accessing a service, as explained in the Google Play services setup guide. This is exactly what you see in action when the end user is prompted to update Google Play Services on the device, and it's the best you as an application developer can do, since you can't force an update on the end user's device and the alternative would be to have your application crash.

Android Wear: Google Play services out of date. Requires 9256000 but found 8701534

I can't get my Android Wear app to work. Every time it tries to open something on the phone I keep getting this error in the logcat:
W/GooglePlayServicesUtil: Google Play services out of date. Requires 9256000 but found 8701534
Nothing should be wrong with my application, because it worked before. It stopped working when I did a factory reset on my LG G Watch.
I checked the Google Play version codes on the watch with an app, and it is (as the logcat tells) 8701534. (Why isn't it updating?) My phone has the version code 9256448. Here are some screenshots:
(Click for larger screenshots).
Here is the (shortened) build.gradle of the watch:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.my.packagename"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.support:wearable:1.3.0'
compile 'com.google.android.gms:play-services-wearable:9.2.0'
}
And here is the (shortened) build.gradle of the phone:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.my.packagename"
minSdkVersion 11
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.google.android.gms:play-services-wearable:9.2.0'
...
}
I have already tried the usual things like:
Factory reset on the watch (About 5 times already)
Cleared cache/data of Google Play services on the phone
Reinstalled Google Play Services on the phone.
Connected the watch to 3 different devices. See below for device names.
Leave the watch connected for about 12 hours. (Both phone and watch connected and on the charger). Nothing changed.
Changed compile 'com.google.android.gms:play-services-wearable:9.2.0' to compile 'com.google.android.gms:play-services-wearable:+'
Here are the phone models I tried on including the watch:
LG G Watch LGW100 (Android 6.0.1, Android Wear 1.5)
Huawei Nexus 6P (Android Nougat Preview 4)
Samsung Galaxy S5 (Android 6.0.1)
Samsung Galaxy S6 (Android 6.0.1)
I'm sure it isn't the phone because I had the watch connected on three different devices.
Do you have any suggestions?
I had the same problem today and somehow I managed to overcome it. Things I did:
reinstalled Android Wear on the phone (due to this)
unpaired the watch from the Android Wear app, then repaired it
resynced apps from the Android Wear app a couple of times
on the watch, in Settings/About/Versions, I tapped the GMS version a couple of times. It should say 'Checking for updates'. At first there were errors in logcat at this operation, then (after reinstalling, etc.) these disappeared.
started Maps and Fit (hoping that they somehow trigger the update)
It finally updated. It took a few days for it to update Google Play services. Now it has version 9.2.56. I guess it just takes some time for the watch to update Google Play services.
You can edit the dependency version:
compile 'com.google.android.gms:play-services-wearable:8.7.0'
Notice 8.7 instead of 9.2. Also please note that this isnt a fix, its a workaround.
Edit: In a perfect world, all watches will instantaneously update to the latest play services, but that doesnt seem to be the case yet. This is also why I declared this as a workaround rather than a fix.
Another option is to manually upgrade Google Play services via odb:
download latest Google Play services apk (from here)
install it via adb install -r com.google.android.gms*
My watches (Samsung Gear S with Wear 1.5) had extremely old version of Google Play services after factory reset (same as yours: 8.7.01 - 534) and did not install any application after pairing. Manually updating play services solved that.

Syncing mobile App to Android Wear

According to the doc: Packing wearable Apps I am using the following code:
dependencies
{
compile 'com.google.android.gms:play-services:5.0.+#aar'
compile 'com.android.support:support-v4:20.0.+''
wearApp project(':wearable')
}
I have generated the release version using the Generate Signed APK. The first time when I install the apk the android wear app is installed properly things are working as required.
I uninstall the app from my mobile. The android wear app also gets uninstalled without any issues, but if I install the app again in my mobile, I don't see the app in the android wear. I am not sure why this is happening. I have tried the same with different apps that that are compatible with android wear those work fine. Install and uninstall and install again, I can see them on android wear emulator.
Here is the build.gradle file from my Application folder:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.ysk.notes"
minSdkVersion 9
targetSdkVersion 20
versionCode 3
versionName "1.02"
}
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies
{
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':FacebookSDK')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
compile 'com.google.android.gms:play-services:5.0.+#aar'
compile 'com.android.support:support-v4:20.0.+'
wearApp project(':Wearable')
configurations
{
all*.exclude group: 'com.android.support', module: 'support-v4'
}
}
Can somebody let me know where I am going wrong?
I had this problem where the wear app wouldn't install. So I made sure the mobile app was installed (after exporting singed APK and doing an ADB INSTALL), then opened the Android Wear app, pressed the gears icon at the top and then selected Resync apps.
I have two suggestions for you that may help.
1) You mention you're using the wear emulator instead of a real watch device. I have experienced issues with connecting and syncing the emulator. Try resetting the emulator and reconnecting through Android Wear on your phone (aka running adb -d forward tcp:5601 tcp:5601) again.
2) There seems to be some caching of versionCode on the Phone and it uses that to know if it needs to resync and update the app on the watch. Try incrementing your versionCode and see if that helps.
Hope one of those helps.
Try unpair and restore factory rest .
It will solve the problems and sync all the data.
It worked for me

Categories

Resources