Android : Error to install Google play services in android emulator? - android

I am using Google Maps on the Android emulator, but it is asking me to install Google Play Services but when I click on install it is crashing.
Thanks in advance

What you need to do is:
Install Google Play Services and Google APis from the Android SDK Manager.
Create an AVD (Android Virtual Device) with a target: Google APIs. The device should run android 4.2 or higher.
For more information check here:
http://developer.android.com/google/play-services/setup.html

Making new emulator with X86 architecture worked for me .

This is a hack from one of the posts on SO that I used and had setup on my machine. Dont have the link right now, if someone could post that please, this is just a dump from back then that I had copied.
1.) Create a new emulator
2.) For device choose "5.1'' WVGA (480 x 800: mdpi)", Target choose "Android 4.1.2 - API level 16", "CPU/ABI" choose "ARM" and The rest choose defaults
3.) Start the emulator
install com.android.vending-1.apk and com.google.android.gms-1.apk via ADB install command
Voila! It worked for me. Last I checked this was only possible otherwise officialy on devices. But that is 2012 December knowledge, I havent checked again

Related

Android Emulator without playstore on android studio 3.1 Latest release

I have updated my android studio 3.0.1 to 3.1 yesterday and i was trying to create AVD of nexus 5 & nexus 5X which default comes with playstore. I installed x86 system image of naugat Android 7.0(Google Apis) on it. When download completes and i boot my AVD then it contains some google apps (gmail,playmusic,playmovie) but doesn't contain google play store or play services. Why it happens? In earlier version of android studio (e.g. 3.0.1) if i follow the same process then it creates AVD with playstore. Can anyone please tell me what's going wrong in this?
[Image of nexus 5 & 5X with playstore logo]1
[Image of my created AVDs not showing playstore symbols]2
You should create a new emulator. Before opening it for the first time, follow these 3 easy steps:
Go to C:\Users\\[user]\.android\avd\\[your virtual device folder] (Windows) or /Users/[user]/.android/avd/[your virtual device folder] (MacOS), open config.ini with a text editor
Change PlayStore.enabled=false to PlayStore.enabled=true
Change image.sysdir.1 = system-images\android-[version]\google_apis\x86\ to
image.sysdir.1 = system-images\android-[version]\google_apis_playstore\x86\
I found a solution. I was selecting system image x86 android nougat 7.0(Google Apis) so, it was only including some google apps but it was not including google play store. I didn't receive any perfect reply on stackoverflow after posting my question so, i report a bug from android studio (Help > Submit Feedback) and they gave me the perfect answer. I was selecting system image having google Apis but if i want to get play store installed on emulator i have to select system images having (google play).
I know it's a silly mistake but no one have replied me with this answer so, i think i should have to post my answer so others can refer this and get help from it so, i have posted my answer.
Try to use Nougat from "Recommended" tab, not from "x86 Images" tab.
You could follow this tutorial Here.
or you can also give it try to genymotion emulator which has inbuilt play store with option of different apis. Here.

How to update Google Play Services for Android Studio 2.2 emulators?

There are a number of variations of this question, however most are very old, and don't really answer the question at all. I'm NOT asking how to install Play Services, that is installed in the Studio 2.2 emulators.
The problem is that these emulators are using an old version of Play services.
When I run a test app that uses Firebase to facilitate Google login I get this alert dialog from a Nexus 5 API 23 emulator:
In the onCreate method of my login activity I have this code:
int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
switch(result) {
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
Log.d(TAG,"SERVICE_VERSION_UPDATE_REQUIRED");
break;
case ConnectionResult.SUCCESS:
Log.d(TAG, "Play service available success");
break;
default:
Log.d(TAG, "unknown services result: " + result);
}
This always returns SERVICE_VERSION_UPDATE_REQUIRED.
Clicking update in the alert dialog does nothing that I can detected. In the debug log I get this message when Play Services startup fails:
W/GooglePlayServicesUtil: Google Play services out of date. Requires 9080000 but found 8489470
My application runs fine on a real Android device.
What simple thing am I missing?
TIA
This may not be relevant to this question now, but wanted to post it here for future explorers, so that they see some land at the end of the sea. I had been struggling with this out of date Google Play Service on my Nexus 5 x86 emulator running API 25 and trying Firebase notification. I am using Firebase 10.0.1 which needs Google Play Services 10.0.1. But on my emulator, I always used to get the message
W/GooglePlayServicesUtil: Google Play services out of date. Requires 1008400 but found 9874900
W/FA: Service connection failed: ConnectionResult{statusCode=SERVICE_VERSION_UPDATE_REQUIRED, resolution=null, message=null}
I had searched extensively a way to update the Google Play Services on my emulator, and whatever was suggested never worked. Finally, I tried creating a new emulator Nexus 5 x86_64 and API 24. Voila!!! It has Google Play Services 10.0.1 and my app works now.
It really beats me why the x86 image does not have the latest Google Play Serviecs and it does not allow me to update it in any manner, while the x86_64 image has the latest Google Play Services.
Hope this helps someone struggling with Google Play Services.
As for my case, I tried checking for updates on Android Studio, as well as the Google Play Services, and restarted Android Studio. Then the update dialog appeared, which allows me to update the emulator images with the correct Google Play Services version.
Wait for the update to finish, then create new AVDs based on the newly updated images, and everything is good to go.
Assuming you're using Android's default AVDs, as opposed to Genymotion, you just have to make sure everything has been updated.
This is what's working for me. If you are using using the current version of play services, 9.6.1 or higher, make sure of the following:
Your build tools version is 24.0.3 or higher
In the SDK Manager (SDK Platforms tab):
If testing Nougat, your emulator is using Google APIs System Image Revision 8 or higher (I'm using "Google APIs Intel x86 Atom_64 System Image")
Google APIs is installed and updated (For me, "Google APIs, Android 24" - Revision 1.0.0)
In the SDK Manager (SDK Tools tab):
Android SDK Platform Tools is version 24.0.3 or higher
Android SDK Tools is version 25.2.2 or higher
Google Play Services is installed and using version 33 or higher
(Probably optional) Google Repository is installed and version 36 or higher
After ensuring all of that, and restarting Android Studio (because better safe than sorry), make a new AVD. I mainly use the following settings:
- Nougat (API 24)
- ABI - x86_64
- Target - Android 7.0 (with Google APIs)
This is working for me, as I was having the same problem this morning until I updated everything. Good luck :)
In case people are still looking for an answer and haven't found any solution that fixes or updates the Google Play Services on their emulators, here's what helped me. I had followed multiple SO posts that recommend getting latest SDK build tools but missed a very important update. That is, from the SDK Platforms you must update/download
Google Play Intel x86 Atom System Image
A picture is worth a thousand words:
This packages will only work for Android 4.2.2 and higher in these answer i am taking an example of (API 17).and it will do work .
Let’s begin by launching the SDK manager. We will first need to ensure that Android 4.2.2 (API 17) and higher is installed.
[shubham#localhost tools]$ ./android sdk
If not, check the top level element, “Android 4.2.2 (API 17)”, click “Install 6 Packages”, and accept the license agreement.
Setting up the image
To get the right image for your virtual device manager:
Open the Android SDK Manager
Open the group Android 4.2.2 (API 17)
Check Google APIs
Check ARM EABI v7a System Image
[![Google Android sdk required tool][1]][1]
Once installed, close the SDK manager and launch the AVD manager. Here we’ll need to create a new AVD which utilizes the Android 4.2.2 platform and has snapshots enabled so that any changes we make are persistent.
[shubham#localhost tools]$ ./android avd
Next we need to pull down the appropriate Google Apps package. Using Android 4.2.2 (API 17) and higher we must use the appropriate package according to below link.
[https://www.androidfilehost.com/?w=files&flid=5649][2]
Once downloaded, extract the archive. In order to install Google Play, we’ll need to push the following 3 APKs to our AVD (located in ./system/app/):
GoogleServicesFramework.apk
GoogleLoginService.apk
Phonesky.apk
However, before we do, we need to make some minor modifications to our AVD. Let’s launch the newly created AVD using the following command. Note that we’ve specified a partition size of 512MB. This is to ensure that our AVD has enough capacity to install the Google Play Store and its dependencies.
[shubham#localhost tools]$ ./emulator -avd Test -partition-size 512 -no-boot-anim
This may take several minutes the first time as the AVD is created. Once started we need to remount the AVD’s partition and modify the permissions of “/system/app/” as this is where our packages will be installed to.
[shubham#localhost platform-tools]$ ./adb remount
[shubham#localhost platform-tools]$ ./adb shell chmod 777 /system/app
And finally, we can push these APKs to our AVD:
[shubham#localhost platform-tools]$ ./adb push ~/system/app/GoogleServicesFramework.apk /system/app/
[shubham#localhost platform-tools]$ ./adb push ~/system/app/GoogleLoginService.apk /system/app/
[shubham#localhost platform-tools]$ ./adb push ~/system/app/Phonesky.apk /system/app/
Now if your emulator is as slow as mine it may take a few minutes for the package to be installed. You’ll know if the installation hasn’t yet completed if the launcher process repeatedly crashes on you ;)
After a few minutes, we should see the Google Play package appear within the menu launcher. After associating a Google account with this AVD we now have a fully working version of Google Play running under your emulator.
Please refer to this link :[http://www.flinkd.org/2013/12/installing-google-play-on-the-android-emulator-api-18/][3]
That should do the work. For more information and tutorial you can watch these video tutorial :-[https://www.youtube.com/watch?v=Nq5mng20PC8][4]
[1]: http://i.stack.imgur.com/Xn2cX.png
[2]: https://www.androidfilehost.com/?w=files&flid=5649
[3]: http://www.flinkd.org/2013/12/installing-google-play-on-the-android-emulator-api-18/
[4]: https://www.youtube.com/watch?v=Nq5mng20PC8
I'm not asking how to install Play Services, that is installed in the Studio 2.2 emulators.
You do seem to be asking how to update it, in which case you do need to know how to install it.
The problem is that these emulators are using an old version of Play services.
That's what the error says, yes.
Possibility one: Your emulator and/or SDK library is outdated, and you need a new AVD.
Possibility two: Go download the latest APK for Play Services and install it. You can use adb to install it, for example. Genymotion will allow you to install APK files by dragging it onto the emulator.
What worked for me is:
Check for and install any new updates. You specifically want to make sure that you're installing the newest version of Google Play Services. Also, you can check for the version of Google Play Services that you're using in the SDK Manager.
Delete all your emulators in the AVD (Android Virtual Device) Manager.
Create new emulator(s).
Should work fine afterwords!
Same problem with API 25, Studio 2.2.3, resolved changing line
compile 'com.google.android.gms:play-services:10.2.0'
to
compile 'com.google.android.gms:play-services:9.8.0'
in build.gradle(Module:app), while waiting for an update of Google Play Services in emulator images.

Using Android Studio 2.0 emulator with Google Services

According to an article in the Android Developers Blog, regarding the release of Android Studio 2.0:
Android Emulator - The new emulator runs ~3x faster than Android’s previous emulator, and with ADB enhancements you can now push apps and data 10x faster to the emulator than to a physical device. Like a physical device, the official Android emulator also includes Google Play Services built-in, so you can test out more API functionality. Finally, the new emulator has rich new features to manage calls, battery, network, GPS, and more.
Great! That's exactly what we need. Later on the article they explain how we can get Google Play Services in our emulators.
Trying out the new emulator is as easy as updating your SDK Tools to 25.1.1 or higher, create a fresh Android Virtual Device using one of the recommended x86 system images and you are ready to go. Learn more about the Android Emulator by checking out the documentation.
I have SDK Tools 25.1.1 installed. I have a fresh Android Virtual Device running x86 system image.
No Google play services :-(
What am I missing?
When you create your virtual device, be sure to choose the one "with Google APIs". If that isn't an option, you will have to use the Android SDK manager to download the Google APIs for each API level you want to work with.

Unable to connect Glass to run gdk samples

I have Glass with version 4.0.4, XE 12.1
I just installed the latest ADT with Android 4.4.2 (API 19) and Glass Development Kit Preview.
My problem is when I try to run samples, DDMS shows the Glass device as being online but when I try to run the application, it gives the following error on the console:
Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
When the Android Device Chooser window opens, there is no entry for Glass in the list.
Glass has debug mode turned on and is visible in DDMS but just not compatible for some reason.
This also brings me to a related question. I just received my device in the mail yesterday and left it charging overnight but still has not updated to XE 16. Glass is connected to wifi and the internet is fine on it. What do I need to do to force it to update itself?
Thanks for your help.
You might try the following:
First, make sure that your Google Glass is updated to XE16 (connect to your home/business wifi; plugin charging cable). Do not attempt to go further until your Google Glass has updated
Once that is done, you might look at some of the other answers to "how do I connect". Some of the steps for this are shown below.
What OS are you using (Windows?). Let me know and I will update the answer with what I had to do to see Google Glass (or look here )
I guess you set the wrong project target.
If you are using Eclipse, open project.properties and make sure the target looks like this:
# Project target.
target=Google Inc.:Glass Development Kit Sneak Peek:15
Not
# Project target.
target=android-15
You can try:
Open project properties (Alt+Enter) -> Android -> Project Build Target -> Glass Development Kit Sneak Peek
BTW, IMO, Glass update is pretty random. I have no idea how Google decides who gets the update. You can flash the system image if you don't want to wait. Please see https://developers.google.com/glass/tools-downloads/system. (Warning: Rooting, unlocking, or flashing your Glass voids your warranty.)
The fact that Glass is displayed under DDMS shows, it is being detected by ADB. The reason you are not able to run the app on Glass is that, your current version of GDK is not compatible with Glass XE 12.1. If you run projects with Android 4.0, you can see your device listed.
In order to resolve this issue, upgrade Glass XE to the latest and try running the app. Then your device will be listed under currently running devices.
Glass XE will be automatically upgraded. Make sure your device is connected to WIFI, connect device to the charger and restart.

How do you install Google frameworks (Play, Accounts, etc.) on a Genymotion virtual device? [duplicate]

This question already has answers here:
How to install Google Play Services in a Genymotion VM (with no drag and drop support)?
(17 answers)
Closed 5 years ago.
I'm currently trying out Genymotion and boy, it's so much faster than the ADT emulator.
But I need to install Google Play to download some apps into it. How do I do this?
Update May 28th, 2017: This method is no longer supported by me and doesn't work anymore as far as I know. Don't try it.
# How To Add Google Apps and ARM Support to Genymotion v2.0+ #
Original Source: [GUIDE] Genymotion | Installing ARM Translation and GApps - XDA-Developers
Note(Feb 2nd): Contrary to previous reports, it's been discovered that Android 4.4 does in fact work with ARM translation, although it is buggy. Follow the steps the same as before, just make sure you download the 4.4 GApps.
UPDATE-v1.1: I've gotten more up-to-date builds of libhoudini and have updated the ZIP file. This fixes a lot of app crashes and hangs. Just flash the new one, and it should work.
This guide is for getting back both ARM translation/support (this is what causes the "INSTALL_FAILED_CPU_ABI_INCOMPATIBLE" errors) and Google Play apps in your Genymotion VM.
Download the following ZIPs:
ARM Translation Installer v1.1 (Mirrors)
If you have issues flashing ARM translation, try re-downloading from a mirror
Download the correct GApps for your Android version:
If you have issues flashing GApps, try re-downloading from a mirror
Google Apps for Android 6.0
Google Apps for Android 5.1
Google Apps for Android 5.0
Google Apps for Android 4.4 (Download from CM11 Links) (4.4 GApps might have bugs)
Google Apps for Android 4.3 (Mirrors)
Google Apps for Android 4.2
Google Apps for Android 4.1
Next open your Genymotion VM and go to the home screen
Now drag&drop the Genymotion-ARM-Translation_v1.1.zip onto the Genymotion VM window.
It should say "File transfer in progress". Once it asks you to flash it, click 'OK'.
Now reboot your VM using ADB (adb reboot) or an app like ROM Toolbox. If nescessary you can simply close the VM window, but I don't recommend it.
Once you're on the home screen again drag&drop the gapps-*-signed.zip (the name varies) onto your VM, and click 'OK' when asked.
Once it finishes, again reboot your VM and open the Google Play Store.
Sign in using your Google account
Once in the Store go to the 'My Apps' menu and let everything update (it fixes a lot of issues). Also try updating Google Play Services directly.
Now try searching for 'Netflix' and 'Google Drive'
If both apps show up in the results and you're able to Download/Install them, then congratulations: you now have ARM support and Google Play fully set up!
I've tested this on Genymotion v2.0.1-v2.1 using Android 4.3 and 4.4 images. Feel free to skip the GApps steps if you only want the ARM support. It'll work perfectly fine by itself.
Old Zips: v1.0. Don't download these as they will not solve your issues. It is left for archival and experimental purposes.
Install Genymotion 2.10 or above, now there is a dedicated button to install Google Play Services name "Open GApps". Link for more info
3 Steps process for Genymotion 2.9 or below:-
4.4 Kitkat
5.0 Lollipop
5.1 Lollipop
6.0 Marshmallow
7.0 Nougat
7.1 Nougat (webview patch)
8.0 Oreo
8.1 Oreo
9.0 Pie
Download from above link
Just drag & drop downloaded zip file to genymotion and restart
Add google account and download "Google Play Music" and Run.
EDIT 2
After three months we can say: no more official Google Apps in Genymotion and CyanogenMod-like method is only way to get Google Apps. However, you can still use the previous project of the Genymotion team: AndroVM (download mirror).
EDIT
Google apps will be removed from Genymotion in November. You can find more information on the Genymotion Google Plus page.
Choose virtual device with Google Apps:
Done:
Now there is official FAQ for using Google Play in How do I install Google Play Services?, here the FAQ text:
For intellectual property reasons, Google Play Services are not
included by default in Genymotion virtual devices. However, if you
really need them, you can use the packages provided by OpenGapps.
Simply follow these steps:
Visit opengapps.org
Select x86 as platform
Choose the Android version corresponding to your virtual device
Select nano as variant
Download the zip file
Drag & Drop the zip installer in new Genymotion virtual device (2.7.2 and above only)
Follow the pop-up instructions
Please note Genymobile Inc. and Genymotion assume no liability
whatsoever resulting from the download, install and use of Google Play
Services within your virtual devices. You are solely responsible for
the use and assume all liability related thereto. Moreover, we
disclaim any warranties of any kind for a particular purpose regarding
the compatibility of the OpenGapps packages with any version of
Genymotion.
Alright, this is probably the easiest way to do it:
First of all, you will have to install GAPPS.
Next, open the virtual box and wait for the home screen to show up on Genymotion.
Drag and drop the GAPPS folder that you had downloaded earlier on into Genymotion.
You would get a prompt. Click OK. You would see a lot of errors, but just ignore them and wait for the successful prompt to come up. Click OK again and restart the virtual device.
A Google account screen should show up. Open up the playstore app if it doesn't show up. Sign into your account. Again ignore the errors.
The playstore should open now and should be fully functional.
I could flash the ARM translation but not the gapps, using https://stackoverflow.com/a/20013322/98057. I got the 'Ooops, something went wrong while flashing gapps-jb-20121011-signed.zip' error mentioned above. If you read the Genymotion logs and find an entry like:
Sep 16 23:00:02 [Genymotion Player] [Error] [Adb][shell] Unable to finished process: "Process operation timed out"
Try to apply the flash using adbdirectly:
$ adb -s 192.168.56.101:5555 shell "/system/bin/check-archive.sh /sdcard/Download/gapps-jb-20121011-signed.zip"
$ adb -s 192.168.56.101:5555 shell "/system/bin/flash-archive.sh /sdcard/Download/gapps-jb-20121011-signed.zip"
$ adb reboot
Change these commands according to what your log files say (the path and IP will probably be different).
I found the Genymobile log files in the following folder, by the way:
~/.Genymobile/Genymotion/deployed/<device name>/genymotion-player.log
Google Apps KitKat for Genymotion.
Download the Google Apps ZIP file from the link which contain the essential Google Apps such as Play Store, Gmail, YouTube, etc.
https://www.mediafire.com/?qbbt4lhyu9q10ix
After finishing booting, drag and drop the ZIP file we downloaded named update-gapps-4-4-2-signed.zip to the Genymotion Window. It starts installing the Google Apps, and it asks for your confirmation. Confirm it.
Try to do all the steps specified in the link below and before that upgrade VirtualBox to 4.2 by following the instructions in VirtualBox 4.2.0 Released With Support For Drag'n'drop From Host To Linux Guests, More. Then upgrade Genymotion to the latest version.
Go to the desktop and run Genymotion. Select a virtual device with Android version 4.2 and then drag and drop the two files Genymotion-ARM-Translation_v1.1.zip first. Then Genymotion will show progress and after this it will promt a dialog. Then click OK and it will ask to reboot the device. Restart ADB. Do the same steps for the second file, gapps-jb-20130812-signed.zip and restart ADB.
I hope this will resolve the issue. Check this link - it explains it clearer.
If anyone got an error while signing in to Google and this message appear:
Couldn't Sign In
can't establish a reliable connection to the server...
then try to sign in from the browser - in YouTube, Gmail, Google sites, etc.
This helped me. After signing in in the browser I was able to sign in the Google Play app...
Sometimes "ARM Translation Installer v1.1" is not working.. Here is the simple solution to install Google Play.
Go to this link: http://www.mediafire.com/download/jdn83v1v3bregyu/Galaxy+S4++HTC+One++Xperia+Z+-+4.2.2+-+with+Google+Apps+-+API+17+-+1080x1920.zip
Download the file from the link and extract to get the Android virtual device with Google Play store. The file will be in the name as “Galaxy S4 HTC One Xperia Z – 4.2.2 – with Google Apps – API 17 – 1080×1920″.
Close all your Genymotion store running in the background.
Copy that extracted file in to the following folder.
C:\Users\'username'\AppData\Local\Genymobile\Genymotion\deployed
After you copy you should see this path:
C:\Users\'username'\AppData\Local\Genymobile\Genymotion\deployed\Galaxy S4 HTC One Xperia Z - 4.2.2 - with Google Apps - API 17 - 1080x1920
Inside the “Galaxy S4 HTC One Xperia Z – 4.2.2 – with Google Apps – API 17 – 1080×1920″ folder you will see many *.vmdk and *.vbox files.
Now open VirtualBox and select Machine->Add and browse for the above folder and import the *.vbox file.
Restart Genymotion. Done.

Categories

Resources