4

I am trying to run the demo android maps project(MapsDemo) that comes along with the Android SDK (Google API 10) on my Kindle Fire but it throws this exception when the application is installing.

[2012-01-31 23:01:15 - MapsDemo] Installing MapsDemo.apk...
[2012-01-31 23:01:17 - MapsDemo] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2012-01-31 23:01:17 - MapsDemo] Please check logcat output for more details.

and Log Cat

01-31 23:06:01.206: D/PackageManager(1372): Scanning package com.example.android.google.apis
01-31 23:06:01.206: E/PackageManager(1372): Package com.example.android.google.apis requires unavailable shared library com.google.android.maps; failing!
01-31 23:06:01.206: W/PackageManager(1372): Package com.example.android.google.apis couldn't be installed.

Same code works fine when i ran in my HTC Desire..

Is it possible to use KML and draw the routes using another way than using the Google APIs?

Anybody knows how to solve this issue ?

kakopappa
  • 5,023
  • 5
  • 54
  • 73
  • 3
    Well it seems obvious, the Kindle Fire doesn't have Google Maps installed, which is needed by this app... Find a way to install it (if possible, I'm not sure, but what I know is you'd need to root it), and it'll work – Guillaume Jan 31 '12 at 16:10
  • possible duplicate of [Android Maps: Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY](http://stackoverflow.com/questions/4509745/android-maps-installation-error-install-failed-missing-shared-library) – Sergey Glotov Jan 31 '12 at 16:16

1 Answers1

7

You cannot use the Google Maps add-on for Android on the Kindle Fire, as it does not exist.

You can add android:required="false" to your <uses-library> element in the manifest, then check at runtime to see if the MapActivity class is available in your virtual machine:

try {
  Class.forName("com.google.android.maps.MapActivity");
  // if you get here, you have Google Maps, so you can safely start a MapActivity
}
catch (Exception e) {
  // if you get here, you do not have Google Maps
}

What you do in the "you do not have Google Maps" case, as you will encounter on the Fire, is up to you.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks, I tried this but did not work. getting java.lang.ClassNotFoundException – kakopappa Jan 31 '12 at 16:22
  • 1
    How can you get an unhandled exception if it's inside the try / catch and your catch is for all the exceptions (Exception)? – SERPRO Jan 31 '12 at 16:34
  • @kakopappa: If that is coming from `Class.forName()`, that will be caught by the above exception handler. If it is coming from something else, perhaps you are trying to use Google Maps before you perform the check I described in my answer. – CommonsWare Jan 31 '12 at 16:34
  • 2
    This worked perfectly for me, but... The "splash" activity cannot be a subclass of MapActivity. This gives you the change to run @commonsware's code to detect whether the device supports Google maps (or not) and to take evasive action if not. – Colin Apr 04 '12 at 18:34