How to fix any Android app dependent on Google Maps API v1 and make maps working
Update - There's a automated script by christian-georgescu
Original post bellow:
It is possible to make maps work inside various Android apps. For Google Account dependent apps, see my other thread: How to fix Gmail, Ingress and other Google Account dependent apps
To fix such app you have to do:
How to find what Google Maps API version apk uses?
- Decompile app APK using apktool
- Check manifest - does it contain text "com.google.android.maps.v2.API_KEY"? If yes, application uses API v2 otherwise it uses API v1.
Patch app which uses API v1
- Decompile app APK using apktool
- Fix or remove Google Maps library dependency in manifest (this one is already known workaround) - the easiest way is to remove line with <uses-library android:name="com.google.android.maps" /> completely
- Download gapps from goo.im either for Android 2.3.3 (for OS 10.1) or Android 4.2.2 (for OS 10.2)
- Extract framework from /system/framework/com.google.android.maps.jar
- Decompile the maps jar using apktool as well
- Move decompiled maps smali code to your decompiled app
- Extract RSA key from the original APK (inside META-INF)
- Convert the key (openssl.exe pkcs7 -inform DER -in *.RSA -print_certs -out cert)
- Get MD5 fingerprint (openssl.exe x509 -noout -in cert -fingerprint -md5), remove colons, to lowercase (SHA1 might be necessary for API v2)
- Find method setAndroidSignature() (for Android 4.2.2 it's in file DataRequestDispatcher.smali, see post #28 for details)
- Current fingerprint is in parameter p1 and it's getting encoded into protobuf. Create new string (const-string v2) with the found fingerprint and use that when invoke-static instead.
- Compile it back, sign (jarsigner), convert, deploy, enjoy
See post #36 for detailed instructions thanks to ATV_Hightower.
How to deal with API v2
- Decompile your app using apktool.
- In file GooglePlayServicesUtil.smali find method isGooglePlayServicesAvailable() and replace the whole content of the method with just:
.locals 1 .param p0, "context" # Landroid/content/Context; .prologue const/4 v0, 0x0 return v0
- Change API v2 key to valid value (one you have registered, see https://developers.google.com/maps/d...ing_an_api_key) - otherwise tiles won't load.
- Pack your app, sign, convert, and deploy.
- Convert and deploy Google Play Services (aka GMS/GMSCore, latest apk is usually required!). com.google.android.gms must be install for maps to work!
Update (2014/01/28): Here's current version of Google Play Services with few patched verifications: Google Play services 4.1.32 (978161-36) patched.apk
WIP: I'm going to check if there's any easy way of reusing the authors fingerprint.
If you only embed framework code into app, it will work but won't load any tiles (app mBank, uses API v1)
With correct fingerprint you have it all working (app Pubtran, uses API v1)
Another example (app Meteor, also uses API v1)
Simple test application using API v2.
lyft also uses API v2.
Last edited by moneytoo; 01-27-14 at 05:03 PM.Thanked by 16:
+ Show/Hide list of the thanked
ATV_Hightower (10-21-13), christian-georgescu (10-28-13), gopi214ever (10-28-13), Guyzer (01-11-14), jmcmanus26 (11-10-13), kratzer999 (10-20-13), ladyintensity (01-26-14), mhhH4RI (05-16-14), mrfreeze (11-18-13), Otech#CB (11-18-13), Ratul Ramchandani (04-15-14), slotime (10-24-13), snejpa (04-25-14), vernigorka (11-18-13), Willeonabe (10-25-13), xandros9 (03-11-15)
I can't promise anything but since I'm definitely going to fix some apps for myself let me know what apps you'd like to fix. Then either me or someone else might fix it. The whole process can be automated so a tool is also possible.
Posted via CB10
- 10-20-13, 11:50 PM #19
you seem like a smart dood. if you can please make it so google maps can allow me to sign in. i need to see my stared locations. i have many other uses for google services framework if you can get it working.
While the described solution works a lot of apps require Google Play Services. Somehow it worked for me for example in the latest official Geocaching app but I need to find more refined solution so please bear with me.
- 10-21-13, 02:06 AM #22BlackBerry History: 8220 > 9800 > 9810 > 9900 > DevAlpha A > Z10 > Z30 > Passport
- 10-21-13, 09:50 AM #23
yeah. i've managed to disable the google maps api, but i would love to be able use it if possible.
i would love a video tutorial.
I attempted this and got to step 6. I assume I'm just supposed to copy and paste the folders into the matching folders in my unpacked apk folders?
I've also made it to step 7, I've renamed the original .apk to .zip and unzipped the file. I've found the .RSA file.
Not sure what to do after... help would be great. how to install openssl?
Last edited by bluetroll; 10-21-13 at 10:55 AM.I LOVE MY
8310 9700 9900 Z10 Z30Passport!
- 10-21-13, 11:03 AM #24
I havent tried it yet, but does it "just" fix the google maps problem or could the google account problem be fixed thisway? I`m asking because I waiting since the first day with my Z10 to play Ingress..
Anyway, it is great that you share your knowledge!
& BlackBerry Z10
- By AfroZepher in forum BB10 Leaked/Beta OSReplies: 16Last Post: 01-21-15, 07:29 AM
- By onlinespending in forum BlackBerry 10 OSReplies: 3Last Post: 10-20-13, 12:26 PM
- By Tony Stashuk in forum BlackBerry Z10Replies: 5Last Post: 10-19-13, 11:44 PM
- By sinnar in forum BlackBerry 10 OSReplies: 4Last Post: 10-19-13, 08:18 PM