0

I have developed map application. In manifest XML i have added <uses-library android:name="com.google.android.maps" /> With this it is working fine in mobile devices and emulator.

But in kindle fire device it is not working, when i remove <uses-library android:name="com.google.android.maps" /> from manifest it is working fine in kindle fire.

Is there any way to use google maps by removing <uses-library android:name="com.google.android.maps" /> from manifest file.

How to use this library reference with out writing in manifest XML.

Vamshi
  • 1,495
  • 1
  • 15
  • 31
  • Did you try what CommonsWare suggested in http://stackoverflow.com/a/9082870/180740 yet? – Philipp Reichart Apr 12 '12 at 12:42
  • possible duplicate of [Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY on Kindle fire](http://stackoverflow.com/questions/9082784/installation-error-install-failed-missing-shared-library-on-kindle-fire) – CommonsWare Apr 12 '12 at 13:14
  • Yes i have checked the link thanks, but it will only allow you to install the app but maps will not work... – Vamshi Apr 12 '12 at 13:23

3 Answers3

2

uses-library has an under-used required attribute on it.

uses-library documentation

Thus:

    <uses-library
        android:name="com.google.android.maps"
        android:required="false" />

If you set this to false, your app will install fine on the Kindle Fire, but the maps API calls will still fail, since the maps library is, in fact, not present. To get around this, you'll need to guard your code to not call the API when it isn't present. I use code like this, myself:

    protected boolean mapsAvailable() {
            try {
                    Class.forName("com.google.android.maps.MapView");

                    return true;
            } catch (ClassNotFoundException exception) {
                    return false;
            }
    }

If mapsAvailable returns false, don't go to any activities using the MapView, don't call any Maps API classes, etc.

Ben Von Handorf
  • 2,326
  • 1
  • 15
  • 17
0

just put this code

String geoAddress  = "geo:" + ll[0] + ","+ ll[1] + "?z=15";
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoAddress));
                context.startActivity(intent);

and add the permission in the manifest

user987760
  • 1,061
  • 3
  • 12
  • 26
0

In order to use Maps API, you must have to provide reference to its library, otherwise NoClassDefFoundError exception will be thrown. Read this.

Community
  • 1
  • 1
waqaslam
  • 67,549
  • 16
  • 165
  • 178
  • You cant! because its not possible to use a library without referencing it to your project. **No Reference! No Candy!** :) – waqaslam Apr 12 '12 at 12:05
  • Still, i don't think so, because as per your Maps API documentation, its *AndroidManifest.xml* that would like to know the reference of it, not your project. Its just like using Internet permission to use web access in your app, and if you don't allow, you just cant use it... – waqaslam Apr 12 '12 at 12:11
  • The Kindle Fire doesn't come with the Google APIs, there's no way to reference or include the library on these devices. – bamnet Apr 13 '12 at 05:41
  • At this point, you are out of luck. Read this http://stackoverflow.com/a/8583906/966550 – waqaslam Apr 13 '12 at 05:53