Using Google Service's FusedLocationProviderClient in a Tablet Emulator - android

I need to emulate an Android Application on a tablet. I'm currently running Android Studio 3.0.
The problem is that the application uses Google Service API's FusedLocationProviderClient (Documentation), which, as far as I understand, requires Google Services 11 as minimum. The current SDK tools for Android Studio seems to only update Google Play Services to 10.9.*, and it seems that no pre-configured Tablet emulators come pre-installed with Google Play Store, meaning I can't simply update it through the settings page the same way that you can with the new phone emulators that has play store pre-installed.
I've tried to find ways to manually update Google Play Services to the newest one available, however almost all previously accepted answers on here seems to simply suggest downgrading build.gradle dependencies to whatever the emulator supports. That doesn't work in this case however, as I need features specifically in the newer versions :/
Is there any way that one can manually update Google Play Services on an emulator?

No mention of what you're saying in the link you provided. However, it was announced here that if you're going to use Google Play Services 11.2.0, your app's compileSdkVersion must be at least 26.
I would suggest that you go to Android SDK Manager and update your API package there. It often includes the System Image for emulators.
You can see on this screenshot that I'm able to use the Android emulator with Android 27 installed because I downloaded it first in the SDK Manager.
I'm able to use API 27 because I installed the system image in SDK Manager:
from SDK Manager, API 27 package is downloaded and installed, hence it's available on the emulator:
You can also check this SO post for additional reference.

Related

Android Emulator stuck on "Google Play Services are Updating"

I recently began learning how to create Google Maps activities in Android app development, and have stumbled onto an issue with Google Play Services. Whenever I set my gradle build dependency to compile 'com.google.android.gms:play-services-maps:11.0.4', which is the most recent version of play-services-maps, the emulator screen gets stuck on the following view upon running my maps app:
I have allowed the app to sit there for over an hour, and nothing has changed or updated. As I've read in other StackOverflow questions, I can get the app to properly function by setting my gradle build dependency to an older version, such as compile 'com.google.android.gms:play-services-maps:9.0.0', but this limits my ability to use newer Android features and APIs in my apps, such as FusedLocationProviderClient.
I am running on Nougat 7.1.1, and have installed the following SDKs in an attempt to solve this Google Play Updating issue:
Android SDK Build-Tools
Android SDK Tools
Google Play APK Expansion Library
Google Play services
Support Repository > Google Repository
I haven't found any StackOverflow threads specific to this "Google Play services are updating" message. What can I do to resolve this issue?
Use API 24 or API 26 Android Emulator system images and you should be good to go. API 25 does not have the latest Google Play Store app pre-installed yet. Note on the screen shot that only these images are "Google Play" versions.
In addition to #Jamal Eason's answer, you may use Nexus 5 and Nexus 5X emulators which have Play Store. Check here. You may also try running on real android device connected via USB that supports google maps and having google play service installed.

Google Play Services SDK (version 38) update

First of all: I am a Software Testing Engineer, so I don't create applications. I use Android Studio for AVD creation, than I install already developed apk file on Android Emulator and make tests. About a month ago I have noticed an annoying pop-up "Update Google Play services" and when I clicked "Update" button - nothing happened.
I don't want to describe all my struggles, but finally I decided that root cause is the outdated Google Play Services SDK (now I have version 38). Android Studio doesn't offers me to update it, and also I can't find any information about version 39. Maybe you know something about this and can help me?
You can always check here the latest version of Google Play service. This is the official documentation of Google Play service that shows you the update and the highlights of each version. This page also shows you how to use the Google Play services APIs in the Android studio.
Note that to test your app using the Google Play services SDK, you must use either:
A compatible Android device that runs Android 2.3 or higher and includes Google Play Store.
The Android emulator with an AVD that runs the Google APIs platform based on Android 4.2.2 or higher.

How to update Google Play Services on the emulator in Android Studio

Hi I am trying to run an Android Program I have created that can connect to Firebase with Authentication using email and password but it seems that I cannot even authenticate due to the fact of them saying my Google Play Service is not up to date.
I am stump here as I have the latest google play services according to my SDK manager
and I don't think it is my code's problem as when I use my friend's phone for debugging it works but not when I am using the emulator.
How can I update my google play services in the Android Studio built-in emulator.
Since Google introduced Google Play Store images in Android SDK Tools 26.0.0 now emulators comes with installed Google Play Store.
When creating Emulator use images that support Google Playstore (currently Nexus 5 and Nexus 5x with android O)
From 26.0.3
Adds a new tab in the extended window for Google Play Store images that displays the Play Services version and a button to check for updates to Play Services.
Edit:
Make sure that you use emulator with playstore is installed. Check if you have sdk manager -> sdk platforms -> Android 8 -> Google Play ... system image installed. Download it. Create new emulator using that image.
I had the same issue and spent half a day working it out.
In your emulator, go to settings->apps->Google Play Services and compare the version used to what appears in your build.gradle file.
In my case the emulator was running an earlier version and no amount of updates seemed to change it.
In build.gradle, I changed the following:
compile 'com.google.android.gms:play-services:9.6.1'
to
compile 'com.google.android.gms:play-services:8.+'
After which I restarted android-studio and it worked flawlessly.
I was facing same issue, but i downgrade my play services version in build.gradle.
settings->apps->Google Play Services application check image
my google play services version is 10.2.98, that's why we need google-play-services(in module level build.gradle) version lower than our emulator's library version.
set the lower version from here, we can see 10.2.6 is better and set it in build.gradle like this
compile 'com.google.android.gms:play-services-places:10.2.6'
and just simple, run app again.
Try to download and install the latest APK for Play Services as stated in this thread.
Based from Google documentation,
If you want to test your app on the emulator, expand the directory for Android 4.2.2 (API 17) or a higher version, select Google APIs, and install it. Then create a new AVD with Google APIs as the platform target.
Try to navigate to settings--> apps in your emulator and then find Google Play Services. Check the version number and use it in you build.gradle. To update it with the latest version, you can see it in these documentation and SO question.
Be noted that updates might not reach all users immediately, so your app should verify the version available before attempting to perform API transactions.

updating Google play services in Emulator

I have gone through many questions like this on Google Play, I am using Android 4.2.2 API 17.
My app requires Google play services 8.1 , It compiles fine and when it runs on emulator it shows message that 'You need to update your Google play services ' ,
When I click on update nothing happens,
How can I update the Google Play services without downloading any latest API version ?
Update On 18-Dec-2017
You can update Google Play Services via the Play Store app in your emulator just as you would on a physical Android device from API 24.
check Emulator new features added with stable update from Android Studio v 3.0
Google Play Support - From Google : We know that many app developers use Google Play
Services, and it can be difficult to keep the service up to date in
the Android Emulator system images. To solve this problem, we now
offer versions of Android System Images that include the Play Store
app. The Google Play images are available starting with Android Nougat
(API 24). With these new emulator images, you can update Google Play
Services via the Play Store app in your emulator just as you would on
a physical Android device. Plus, you can now test end-to-end install,
update, and purchase flows with the Google Play Store.
Quick Boot - Quick Boot allows you to resume your Android Emulator
session in under 6 seconds
Android CTS Compatibility
Performance Improvements - With the latest versions of the Android
Emulator, we now allocate RAM on demand, instead of allocating and
pinning the memory to the max RAM size defined in your AVD.
Virtual sensors
Wi-Fi support
GPS location and Many more...
OR
Update this SDK Build-Tools and Android Emulator to latest and this alert message will not come again,
Settings --> Android SDK --> SDK Tools(tab) --> Android SDK
Build-Tools
Use/ emulate a system-image that has "Play Store" pre-installed, those with "Google Play" in targets column (instead of Google APIs). Updating play services would be as easy as in real device.
Since Google introduced Google Play Store images in Android SDK Tools 26.0.0 now emulators comes with installed Google Play Store.
From 26.0.3
Adds a new tab in the extended window for Google Play Store images that displays the Play Services version and a button to check for updates to Play Services.
But even with all above (last checked 2022), you can NOT use the Emulator to test Google Play Billing:
You must install your application on a real device to test Google Play Billing,
Or, ask Google for "closed testing" permission.
see How to test In-app Billing on an emulator?
You need install Google play image,
Android SDK -> SDK platforms --> check show Package details --> install Google play.
Based from Google documentation,
If you want to test your app on the emulator, expand the directory for Android 4.2.2 (API 17) or a higher version, select Google APIs, and install it. Then create a new AVD with Google APIs as the platform target.
Try to navigate to settings--> apps in your emulator and then find Google Play Services. Check the version number and use it in you build.gradle. To update it with the latest version, you can see it in these documentation and SO question.
Running the app on a virtual device with system image, 'Google Play API' instead of 'Google API' will solve your issue smoothly..
Virtual devices Nexus 5x and Nexus 5 supports 'Google Play API' image.
Google Play API comes with Nougat 7.1.1 and O 8.0.
Just follow the below simple steps and make sure your pc is connected to internet.
Create a new virtual device by selecting Create Virtual Device(left-bottom corner) from Android Virtual Devices Manager.
Select the Hardware 'Nexus 5x' or 'Nexus 5'.
Download the system image 'Nougat' with Google Play or 'O' with Google Play. 'O' is the latest Android 8.0 version.
Click on Next and Finish.
Run your app again on the new virtual device and click on the 'Upgrade now ' option that shows along with the warning message.
You will be directed to the Play Store and you can update your Google Play services easily.
See your app runs smoothly!
Note: If you plan to use APIs from Google Play services, you must use the Google APIs System Image.
the answers on this page eluded me until i found the show package details option
My answer is not to update the Google play service but work around.
Get the play service version of the emulator by using the following code
getPackageManager().getPackageInfo("com.google.android.gms", 0 ).versionName);
For example if the value is "9.8.79" then use the nearest lesser version available com.google.android.gms:play-services:9.8.0'
This will resolve your problem. Get the release history from https://developers.google.com/android/guides/releases#november_2016_-_v100
I know it's late answer but I had same problem for last two days, and none of the above solutions worked for me. My app supports min sdk 16, Jelly Bean 4.1.x, so I wanted to test my app on emulator with 16 android api version and I needed Google Play Services.
In short, solution that worked for me is:
make new emulator Nexus 5X (with Play Store support) - Jelly Bean 4.1.x, 16 API level (WITHOUT Google APIs)
manually download apks of Google Play Store and Google Play Services (it is necessary that both apks have similar version, they
need to start with same number, for example 17.x)
drag and drop those apks into new emulator
congratulations you have updated Google Play Services on your 4.1.x emulator
Here are the steps and errors I have encountered during the problem.
So I have made new emulator in my AVD. I picked Nexus 5X (with Play Store support). After that I picked Jelly Bean 16 api level (with Google APIs). When I opened my app dialog pop up with message You need to update your Google play services. When I clicked on Update button, nothing happened. I did update everything necessary in SDK manager, but nothing worked. I didn't have installed Google Play Store on my emulator, even tho I picked Nexus 5X which comes with preinstalled Play Store. So I couldn't find Google Play Store tab in Extended Controls (tree dots next to my emulator).
Because nothings worked, I decided to try to install Google Play Services manually, by downloading APK and dragging it into emulator. When I tried this, I encountered problem The APK failed to install. Error: INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES. I figured that this was the problem because I picked Jelly Bean 16 api level (with Google APIs). So I made new emulator
Nexus 5X (with Play Store support) - Jelly Bean 16 api level (WITHOUT
Google APIs)
This allowed me to install my Google Play Service manually. But when I run my app, it still didn't want to open it. Problem was that my emulator was missing Google Play Store. So I installed it manually like Google Play Service. But when it was successfully installed, dialog started popping out every second with message Unfortunately Google Play Services has stopped. Problem was that version of my Google Play Store was 17.x and Google Play Service was 19.x. So at the end I installed Google Play Service with version 17.x, and everything worked.
I faced the same issue. I updated my Android studio and used API 25 target as Android 7.1.1 and X86 and everything worked fine. I use Google play services and firebase for my project
I was having the same issue. Just avoid using an emulator with SDK 27. SDK 26 works fine!
2020 , the error
Google Play services out of date. Requires 12451000 but found 11743470
just update Google Play services from the Google Play after you sing-in with a valid account.
PS: I've tried different Emulator versions, but all required to update google play services.
Update your google play services or just create the new emulator.
When you install the new emulator this problem will automatically be solved.
Happy coding :)

"This app won't run unless you update Google Play Services" when app is installed on real device

When I install my app on Android devices running older versions (for example 4.4.4), I get this message. All the other posts I can see relating to this message seem to be when running on the emulator and related to Google Maps API. I am using Google Play Service 7.0.0.
This android developer's blog entry describes what's new in the version 7.0 of Google Play services.
If you don't need those you're good to go with version 6.5 which already uses new GoogleApiClient class and provides granular dependency modules (best described here and here.
In one of my projects i use this
compile 'com.google.android.gms:play-services:6.5.87'
It's the whole package and I'll pick only the modules I need before deployment. Works fine against target API 22.
The farthest version I'd go with would be
compile 'com.google.android.gms:play-services:6.1.71'
This one introduced the unified GoogleApiClient approach used today.
So should I use an older SDK?
Absolutely not, this is not an SDK related problem. Keep everything (build tools, compile SDK, target SDK) to 22.
is there a better way to handle this than asking my users to update their Google Play Services?
See above, use older version of the library with your project.
"This app won't run unless you update Google Play Services" when app is installed on real device
You get this message on your phone because your device has low version of google play service compared to the one used in the app.
Updating it, will work properly

Categories

Resources