I'm facing some rare problem. I have a device running on Android API 14. Anytime I try to use MapActivity I get the same error - java.lang.NoClassDefFoundError: android.security.MessageDigest. On other 99% devices it works perfect.
After some digging, I've found root of the problem.
The error is the result of a device manufacturer or ROM creator using
an older maps library with a new version of Android. (more at
What is 'android.security.MessageDigest''?)
The functionality of MapActivity isn't required for application, so I want to check if user has such device.
How can I get user's google api version on android?
Use Google map v2.
You want to use Google map console to register SHA-1 for signing the key in Google api console.
The complete tutorial can be found here.
Related
I'm trying the HelloGoogleMaps project from this official google tutorial, and I get the applicaiton running just fine, 'cept the map isn't showing; instead you can see a grid without any data. Doing some research I found that the API key could be malfunctioning; I must have done something wrong. But I dont know what it could be, as I followed the instructions given in the Google Developers Console. Here's what I did to get the key:
I clicked on Create New Key
I clicked on Android Key
I discovered the SHA1 fingerprint of my developer certificate using the following command:
keytool -list -v -keystore C:\Users\Viktor.android\debug.keystore
I copied the SHA1 certificate and pasted it as the example shows:
45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:12:17:F2:56:26:A0:E0;com.example
I got the key and placed it in res/layout/main.xml
I did make a OAuth 2.0 Client just in case, and also activated the following APIs in Google Developer's console:
Google Maps Android API v2, Google Maps Coordinate API, Google Maps Geolocation API, Google Maps JavaScript API v3, Google Maps Tracks API.
Maybe there is some conflict? Maybe its something version related?
The minimun sdk is API 10 Android 2.3.3 Gingerbread.
The target sdk is API 21 Android 4.x (L Preview), and selected Google APIs 10 to compile it.
There is a mess with the versioning, and all tutorials and solutions I find are not updated, even google tutorials refer to old versions. Anyone can point me in the right direction?
SOLUTION
Emulators won't work, as they dont have a GPS or anything, so the best thing is to use a real android device. I tried the answer below, with the genymotion thing and got no result.
Inbuilt google Emulator will not support google map. Try installing Genymotion emulator and try again.
Also API v1 is deprecated. Try going over the steps mentioned in google site for api v2 https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2
I am building an application which has its major functionality on google maps. But the problem I am facing in one of the device is that:
The Google Maps never load on that device [its OS is Android v2.2]
I have checked for the Google Play Service and it always gives a dialog to update the Google Play service; but when I click ok it redirects me to the play store where it shows that i already have the google play library [No update option there]
I connected the device and checked the logcat which states something like this:
"Current Google Play Service Version is 35xxx and required is 41xxx"
but there is No way for me to update the google play service as it never shows the update option. Please help me with this issue.
Give me all possible solution that i should try out... I need this app working on android 2.2.
I am using google maps api v2. Also Note the app is working fine on all other android versions.
Thanks.
USING Google Maps v1 can SOLVE MY PROBLEM....?? Please Help!
You need to use older version of Google Maps Android API v2.
The latest supported on 2.2 devices is 3.2.65 (v12) and can be downloaded via SDK Manager.
Just look for Google Play services for Froyo.
Or if you are using Android Studio and Gradle, make your dependency version equal to 3.2.65.
I'm migrating an app from Google Maps Android API v2 to Google Maps Android API for Business following instructions here : https://developers.google.com/maps/documentation/business/mobile/android/config#migrate_an_existing_application
This should be very straightforward but unfortunately after replacing all the com.google.android.gms.maps references to com.google.android.m4b.maps, the app is compiling right but the map is not showing : I get a gray rectangle instead.
One possible reason (and actually one thing I don't understand so far) is that the API key is the exact same as the one I used for Google Maps Android API. Logically, there should be a personal code to enter somewhere, something like the Client ID / Crypto key I've been sent by Google.
Can anyone help me?
From the documentation link below ,
https://developers.google.com/maps/documentation/business/mobile/android/auth
there seems to be a hidden service named "Google Maps Mobile SDK service"
which will be enabled by Google Enterprise Support when you sign up for the Google Map Mobile SDK for Business.
Once we purchase Business licence, enable this service in our project
and generate a Map V2 API key using same procedure for non business version
we should be able to see the tiles loading on Android Device.
Note:This observation is only based on documentation link above and not an experimented one.
i have made an android application and in it , there is one scenario when the user clicks on an address and that address shows up on google maps.
Now when i tested the application on the emulator, the google maps did load properly, but now that i am trying the same on my htc desire z, the maps is not loading.
Although the maps application which came built-in in my phone is loading google maps correctly.
what could be the problem? why is my application not able to load the map view?
thank you in advance.
EDIT: i have obtained a google map api key and have included it in the mapview that i am using.i have added overlays and etc. It is all showing fine on the emulator , but on my device it is not showing any maps. The overlays are visible.
There is a difference between a debug maps API key and a release maps API key. With the first it will only run on the emulator.
Unless you have visited the Google site twice (once to get a key which matches the debug keystore and once to get a key which matches your release keystore) then you haven't got a release key and your app won't run on real device.
Our Android developers were also facing this problem. We solved the problem like this:
We generated API keys from each machine and added the Key to their respective main.xml file. So each developer had a separate api key.
We started the emulator from the command line using the android "emulator" command which is located in the tools directory and started with the proxy option instead of starting it from eclipse, eg :
E:>emulator -avd New_Device -http-proxy http://202.0.0.203:808
Most probably, you didn't register your application into the system. This is the link.
http://code.google.com/android/add-ons/google-apis/maps-api-signup.html
If this is not the case, please provide the error details from Logcat.
You need to get an API key from Google.
Here is a good article that explain how to obtain API key.
Is it possible to use Google Maps Android library in my app in a way, that the app can be installed even on phones without Google Maps? On phones without Google Maps, the maps feature would be disabled.
Is it possible to use Google Maps Android library in my app in a way, that the app can be installed even on
phones without Google Maps?
There is an undocumented android:required="false" flag you can put on the <uses-library> element. I am hopeful that they will document this in a future release. With that set to false, you would need to use reflection to see if Google Maps is loaded (e.g., try to find the MapView class) -- if not, disable whatever would lead the user to a map.
If anybody else has the same problem (I do):
On this Android Developer page it says -- as far as I can tell -- that you can reference the Maps API and thus have e.g. a map activity in your app by using Google Play services:
"The Google Maps Android APIs are not included in the Android
platform, but are available on any device with the Google Play Store
running Android 2.2 or higher, through Google Play
services.
To integrate Google Maps into your app, you need to install the Google
Play services libraries for your Android SDK. For more details, read
about Google Play
services."
Apparently it is an actual app (it is installed on my phone) that updates certain Google stuff.
So it seems it is possible, but only for devices running Android 2.2 (API level 8) and above.
I find the explanation on that site a bit unclear, however, and I have not been able to test this on my own.
In my case, I guess I have to live with the fact that not all devices will be able to install my app, since I target an API < 8.