Android Question Google maps in emulator

hatzisn

Expert
Licensed User
Longtime User
Hi everybody,

is it possible to use Google Maps in an Emulator. If it's possible how is it done?

Thanks in advance
 

hatzisn

Expert
Licensed User
Longtime User
Edit - I googled it and found that I have to use an emulator with Google APIs.
I created an AVD with Google APIs and installed my app in it. It did not work.
It is interesting that the AVD has an Internal Google Maps application that works
(as you can see in the pictures).

Screenshot_1523700313.png
Screenshot_1523700658.jpg


The following code that is contained in my application shows the toast
"Google Play services not available". In a real device it works perfect.

B4X:
If mFragment.IsGooglePlayServicesAvailable = False Then
   ToastMessageShow("Google Play services not available.", True)
   bMap = False
Else
   bMap = True
End If

Any ideas? How can it display the Google Maps internal app in the emulator
if Google Play Services is not available? The emulator is SDK 19.
 
Last edited:
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
I manage and run AVD in Android Studio directly. There is x86 image of KitKat with Google API.
After a small manipulation with settings my app works without problems.
Can't describe exact sequence of actions. Approximately -
1) I run Map application and enter to Google account.
2) Then I go to settings and turn off/on location
3) Then I change longitude/latitude in emulator settings.
Probably, will work and without some actions.
 
Upvote 0

dcoun

Member
Licensed User
Longtime User
if you use google images for AVD you should download API 24 images and up, these with playstore.
Has Δράκου 14 anything special?
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
if you use google images for AVD you should download API 24 images and up, these with playstore.
Has Δράκου 14 anything special?

Nothing special dcoun. It is just near my home address. Thanks for your reply...
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Thanks Erel. Where can I download these images with playstore. I googled around a lot but I don't find it. All I found is a post that you can download system images with Android Studio. Is this the correct way?
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Hello again everybody,

I used as advised the sdk manager and I still cannot see in the images the google_apis_playstore. Here is what I got:

SDKManager.jpg


And in the AVG Manager I see this:

AVDManager.jpg


And indeed the google_apis_playstore are installed. See the following picture:

Explorer.jpg


Am I missing something here? Did I forget to do anything?

Any help will be highly appreciated...
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
What I am trying to accomplish is to create an emulator with google_apis_playstore as Erel has done in order to
run applications with google maps. I see google_apis in AVD Manager as in the picture but no google_apis_playstore
in order to create the desired emulator. See the earlier post of Erel.
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
In SDK Manager it is downloaded as you can see in the pictures. The problem is that I don't see the image in AVDManager.
Further more as you can see in the Explorer window it is downloaded and installed. My B4A version is 7.80.
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Erel where does AVDManager find the information of installed system-images? Maybe I can hard code it in it...
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Thanks Erel
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Hi Erel,

I just compiled and tried the new sdk manager as you proposed. It creates indeed the google play emulator and I am able to start it correctly.
The problem is that when I compile my B4A program I get the following:

B4X:
B4A Version: 7.80
Parsing code.    (0.26s)
Compiling code.    (0.48s)
    
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.06s)
Organizing libraries.    (0.00s)
Generating R file.    (7.41s)
Compiling generated Java code.    (4.73s)
Convert byte code - optimized dex.    (4.92s)
Packaging files.    (1.32s)
Copying libraries resources    (0.03s)
    Found 2 resource files.
Signing package file (private key).    (1.91s)
ZipAlign file.    (0.41s)
Installing file to device.    Error
No device found.

No matter how many times I restart the ADB server I still get the same. This only happens on Google Play images...
My B4A version is 7.80 as seen. Any incompatibilities with this version? Any other ideas?

Thanks
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Hello Erel,

when I have started the Google Play Emulator the output that I get from "adb devices" is the following:

B4X:
C:\B4A\android-sdk\platform-tools>adb devices
List of devices attached
emulator-5554   unauthorized

When you say: "Have you set android.jar to the android.jar from B4A Sdk Manager?" what do you mean?
You mean setting the android.jar in Tools>Configure Paths? Mine is set to:
C:\B4A\android-sdk\platforms\android-27\android.jar

Thanks for replying...
 
Upvote 0
Top