Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

accessing google apis in the new intel x86 android emulator

Tags:

I just tried to run my company's app in the new x86 android emulator, but our app relies on the google maps API, and that is not available in the x86 system image that google provided with android sdk release 17. My intuition says the answer is no, but is it possible to get the google apis into this system image somehow? If not, is there any way to conditionally not use a system API like google maps if it isn't present on the device/emulator that you are currently using?

like image 212
Kevlar Avatar asked Mar 23 '12 22:03

Kevlar


People also ask

What is Google Apis Intel x86 Atom System Image?

The x86 Android* emulator system image enables you to run an emulation of Android on your development machine. In combination with the Android SDK, you can test your Android applications on a virtual Android device based on Intel Architecture.


2 Answers

You have to create a system image with Googles libs and permissions. See http://38911bytes.blogspot.de/2012/03/how-to-use-google-maps-api-in-android.html for a cookbook to create and use such an image.

like image 104
user1296459 Avatar answered Oct 03 '22 03:10

user1296459


My intuition says the answer is no, but is it possible to get the google apis into this system image somehow?

There is but the one image, so if Maps are not there, then Maps are not there. You cannot add the Maps add-on to an existing emulator image, except perhaps via software piracy, as the other answer on this question advocates.

If not, is there any way to conditionally not use a system API like google maps if it isn't present on the device/emulator that you are currently using?

Absolutely!

Step #1: Add android:required="false" to your <uses-library> element for Google Maps, so you can install the app

Step #2: Sometime before you start trying to use Google Maps, see if you have Maps-related classes using Class.forName()

For example, in this book sample project, my launcher activity sees if we have MapActivity, and if we do, it passes control to a MapActivity instance, and if not shows a Toast.

like image 27
CommonsWare Avatar answered Oct 03 '22 04:10

CommonsWare