MapsHack3000 at the end of the Berlin hackathon
Introduction
We extracted the new Google Maps Library v2 from the "Field Trip" application. It can be used in your own apps as an apklib.
Maps Library v2 has some advantages to the out-dated version v1:
- 3D view
- ground overlays/polylines that do not overlap map labels
- can use Fragments
Prerequisites
smali/baksmali - https://code.google.com/p/smali/downloads/list
dex2jar at least version 0.0.9.11 - http://code.google.com/p/dex2jar/downloads/list
Maven Version 3 - http://maven.apache.org/
FieldTrip.apk - Probably https://play.google.com/store/search?q=com.nianticproject.scout in the US
apktool - https://code.google.com/p/android-apktool/downloads/list
Step 1: Extract library
unzip <fieldtrip.apk> classes.dex
- extract smalifiles
java -jar baksmali-1.2.7-dev-jar-with-dependencies.jar -o smali-files classes.dex
- remove support-v4 library
rm -r smali-files/android
- remove most R*-files
rm smali-files/com/google/maps/R.smali smali-files/com/google/maps/R\$anim.smali smali-files/com/google/maps/R\$array.smali smali-files/com/google/maps/R\$attr.smali smali-files/com/google/maps/R\$bool.smali smali-files/com/google/maps/R\$color.smali smali-files/com/google/maps/R\$dimen.smali smali-files/com/google/maps/R\$drawable.smali smali-files/com/google/maps/R\$id.smali smali-files/com/google/maps/R\$integer.smali smali-files/com/google/maps/R\$layout.smali smali-files/com/google/maps/R\$menu.smali smali-files/com/google/maps/R\$raw.smali smali-files/com/google/maps/R\$string.smali smali-files/com/google/maps/R\$style.smali smali-files/com/google/maps/R\$xml.smali
- re-assemble smali files
java -jar smali-1.4.0.jar -x -a 9 smali-files/ -o mapfragment.dex
- make classes jar from dexfile
dex2jar-0.0.9.11/d2j-dex2jar.sh mapfragment.dex --force
- install jar to local maven repository
mvn install:install-file -DgroupId=de.schildbach.maps -DartifactId=maps-v2 -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=mapfragment-dex2jar.jar Step 2: Make apklib
- Extract resources with apktool
apktool d <fieldtrip.apk> fieldtrip
- copy the following resources from fieldtrip
res/drawable/btn_myl.xml
res/drawable/btn_zoom_down.xml
res/drawable/btn_zoom_up.xml
res/drawable/dav_background_grid.png
res/drawable/dav_colored_polyline.png
res/drawable/dav_dashed_highlight_16_256.png
res/drawable/dav_drop_shadow_gradient.png
res/drawable/dav_one_way_16_256.png
res/drawable/dav_road_10_128.png
res/drawable/dav_road_12_128.png
res/drawable/dav_road_14_128.png
res/drawable/dav_road_22_128.png
res/drawable/dav_road_32_128.png
res/drawable/dav_road_32_64.png
res/drawable/dav_road_40_128.png
res/drawable/dav_road_44_64.png
res/drawable/dav_road_48_128.png
res/drawable/dav_road_48_64.png
res/drawable/dav_road_56_128.png
res/drawable/dav_road_8_128.png
res/drawable/dav_road_hybrid_6_32_high_zoom.png
res/drawable/dav_road_hybrid_6_32_low_zoom.png
res/drawable/dav_route_line.png
res/drawable/dav_route_line_bright.png
res/drawable/dav_traffic_bg.png
res/drawable/dav_traffic_fill.png
res/drawable/dav_traffic_frame_1.png
res/drawable/dav_traffic_frame_2.png
res/drawable/dav_traffic_frame_3.png
res/drawable/dav_traffic_frame_4.png
res/drawable/dav_traffic_frame_5.png
res/drawable/dav_traffic_frame_6.png
res/drawable/dav_traffic_frame_7.png
res/drawable/dav_traffic_frame_8.png
res/drawable/popup_pointer_button.xml
res/drawable-hdpi/btn_flat.9.png
res/drawable-hdpi/btn_myl_normal.png
res/drawable-hdpi/btn_myl_pressed.png
res/drawable-hdpi/btn_zoom_down_disabled.png
res/drawable-hdpi/btn_zoom_down_normal.png
res/drawable-hdpi/btn_zoom_down_pressed.png
res/drawable-hdpi/btn_zoom_up_disabled.png
res/drawable-hdpi/btn_zoom_up_normal.png
res/drawable-hdpi/btn_zoom_up_pressed.png
res/drawable-hdpi/dav_blue_dot.png
res/drawable-hdpi/dav_chevron.png
res/drawable-hdpi/dav_compass_needle.png
res/drawable-hdpi/dav_compass_needle_large.png
res/drawable-hdpi/default_marker.png
res/drawable-hdpi/floorpicker_bg_selected.9.png
res/drawable-hdpi/floorpicker_mylocation.png
res/drawable-hdpi/floorpicker_search.png
res/drawable-hdpi/fproundcorner.9.png
res/drawable-hdpi/google_watermark.png
res/drawable-hdpi/ic_action_search.png
res/drawable-hdpi/ic_launcher.png
res/drawable-hdpi/loading_spinners_layers_220x20px.png
res/drawable-hdpi/popup_pointer_button_normal.9.png
res/drawable-hdpi/popup_pointer_button_selected.9.png
res/drawable-hdpi/suggest_blank.png
res/drawable-hdpi/suggest_contact.png
res/drawable-hdpi/suggest_history.png
res/drawable-hdpi/suggest_star.png
res/drawable-ldpi/ic_launcher.png
res/drawable-mdpi/default_marker.png
res/drawable-mdpi/ic_action_search.png
res/drawable-mdpi/ic_launcher.png
res/drawable-nodpi/vm_blue_dot_obscured_off.png
res/drawable-nodpi/vm_blue_dot_obscured_on.png
res/drawable-nodpi/vm_blue_dot_off.png
res/drawable-nodpi/vm_blue_dot_on.png
res/drawable-nodpi/vm_chevron_obscured_off.png
res/drawable-nodpi/vm_chevron_obscured_on.png
res/drawable-nodpi/vm_chevron_off.png
res/drawable-nodpi/vm_chevron_on.png
res/drawable-nodpi/vm_gray_dot_off.png
res/drawable-nodpi/vm_gray_dot_on.png
res/drawable-xhdpi/default_marker.png
res/drawable-xhdpi/ic_action_search.png
res/drawable-xhdpi/ic_launcher.png
res/layout/activity_main.xml
res/layout/button_container.xml
res/layout/da_infobox.xml
res/layout/da_infobubble.xml
res/layout/floor_picker.xml
res/layout/zoom_controls.xml
res/raw/dading.mp3
res/raw/dav_k2.bin
res/raw/driving.mp3
res/raw/negative.mp3
res/raw/nolocation.mp3
res/raw/nonetwork.mp3
res/raw/ring32.ogg
res/raw/ring35.ogg
res/raw/ring36.ogg
res/raw/ring38.ogg
res/raw/ring40.ogg
res/raw/scanning.ogg
res/raw/sonar.mp3
res/raw/startup.mp3
res/raw/synchronize.mp3
res/values/arrays.xml
res/values/attrs.xml
res/values/bools.xml
res/values/colors.xml
res/values/dimens.xml
res/values/ids.xml
res/values/integers.xml
res/values/strings.xml
res/values/styles.xml
res/values-large-v11/bools.xml
res/values-sw600dp/bools.xml
res/values-v16/bools.xml
Make an apklib from the resourcses and insert maps-v2 lib from above as a dependency.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.schildbach.maps</groupId>
<artifactId>maps-v2</artifactId>
<packaging>apklib</packaging>
<version>1.0-SNAPSHOT</version>
<name>mapsv2 apklib</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.0.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.schildbach.maps</groupId>
<artifactId>maps-v2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins> <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <version>3.4.0</version> <extensions>true</extensions> </plugin> </plugins>
</build>
</project>
We will provide a BitBucket repo with all the files necessary (Except Fieldtrip.apk) soon.
Team:
Andreas Schildbach (https://plus.google.com/114712911621260660401)
Dirk Jäckel (https://plus.google.com/110167958764078863962/posts)
Tatiana V. Rybnikova (https://plus.google.com/117070317944894991932/posts)