(03/11/12 ) Google just announced a new version of Maps APIs so expected a revamp of this tutorial quite soon as I found a way to implement the new system !
In fact, it should be simplier : Just use a standard SlidingFragmentActivity extending SherlockFragmentActivity and use a MapFragment.
The advantage of this new « MapFragment » is to avoid having FragmentActivity built over MapActivity adding « useless » functions to your Activity object when you don’t use a Map ! If you don’t get it, it means your don’t need a special ActionBarSherlock and just the pom.xml from my SlidingMenu … ( I still have to check potential dependency tree issues )
(12/12/12) Hum… I checked GMaps API v2… Quite cool for simple stuffs but LOOKS LIKE HORRIBLE for advanced projects… ! The new APIs doesn’t fit my usage and I’m thinking about staying on the V1 … or wait a v3 😡
As an example : If you used a real time thread to modify your overlay’s bitmaps… you have to create new Markers/Overlay objects every time… ! Great memory management.
MyLocationOverlay looks like it was merged into a higher level abstraction so that you can’t provide it the GPS data you might collect with your own location service over the application state…
I might be wrong but let’s be honest : it sucks and it’s tough to move from v1 to v2 if you did advanced features.
I’ll try to make a new post with GMaps V2 when something is definitly working 🙂
What’s for ? :
As I’m going to create an upcoming SIG App for one of my engineering school project, I wanted to use both ActionBarSherlock and SlidingMenu … but as it’s a teamwork… people expected to have some Maven stuff to ease IDE setup. You might want to check it out for a complete example working just with a Mercurial repository import in Eclipse.
It was quite troublesome since I barely know how works Maven ! ( In fact It has started to become clearer as I spent 5 hours to get it working ! )
(3/02/13) if you want to see the result here it is :
A video of the full app is available there :
http://www.youtube.com/watch?v=lmylZhI64oM
The requirements :
- First, I suggest to get Maven 3, do the path stuff to use it as command line ( scroll down the download page of Maven website for more explanations ).
- Now some android maven setup ( you just need to do the ANDROID_HOME path trick ).
- Ok now, you should be able to build stuff with Maven !
- You might already know that Maven create a « .m2 » directory in your « home » ( in windows something like : C:\Users\Kayrnt\.m2\ ) inside, it creates your local repository !
As I’m building Android projects, I need Android SDK to be in this repository and referenced as a maven dependency source.
That’s where Maven Android SDK Deployer is really useful ! - Download it there and do a « mvn clean install » inside the directory.
If you are lazy, you check my maven repository where you can find Android SDK 4.1.2.
It should do the stuff !
The snippets/custom versions :
OK now the the snippets I wrote or modified :
- ActionBarSherlock 4.2.0 ( I modified sources to use android support v4 with maps)
- SlidingMenu (it’s a modified one with ActionBarSherlock support and with the pom.xml inside)
- Finally an example of my pom.xml for my final project !
If you use my « final » pom.xml is as an « example », don’t forget to completed it with signing / zipalign etc… see the maven android website.
You just have to do « mvn clean install » in ActionBarSherlock then in the SlidingMenu directory and you’re done !
Finally use « mvn android:deploy » to deploy the apk on your device.
I set the SlidingMenu apklib version to 1.0.0 since there aren’t any for the time being.
Note that it could be interesting to upload it to Maven central !
Now some potential troubleshooting :
It looks like m2e-Android doesn’t support correctly apklib in Eclipse. However building with maven in console works properly with just apklib files.
Adding « jar » files to your pom.xml allow m2e-Android to detect classes correctly but you can’t use ressources ( like @style/Theme.Light.Sherlock ) like this.
To work properly… just have your projects opened in your workspace ( the ones declaring the apklib used in your main project ).
M2e-android-configurator has a certain issue with APKlib showing problem at building in eclipse even it’s compiling just fine using a terminal.
In fact, if you want to build with maven and still want to use Eclipse as an IDE, you need to get the « Android library projects » opened in your workspace !
You might also need to specify JDK 1.6 in run configuration of your maven build if you use Eclipse else it might not find « tools.jar » instead of a JRE.
Hello Im using you code and I’m getting the already added error for the ActionBarSherlock … I already change the android support 13 dependency but still getting many already added errors with the ActionBarSherlock lib
Can you give me any suggestion?
Yup the common mistake would be to have the android support v4 somewhere in one of your other projects 🙂
Because v13 includes v4 or something like that. check your /libs in your projects if you build without maven else you might want to reread your dependencies and be sure you link to the same v13.
Hum… in fact, I updated my libs & added the android-support-v4-gmaps for slidingMenu using Fragment for everything like MapActivities 🙂
I didn’t edited my zips for the time being as I’m still testing if everything is fine. I’ll probably edit the post tomorrow.
Hi, I integrated SlidingMenu into my project and it is working fine. Thanks!
Now I need to push those files from my local repo to my remote repository. Could you please help me with that?
What do you want to push ? Your Android sources ? Your APK ?
Is your sources a part of library, you need to share in another Android project ?
Which kind of repository ? SVN, GIT or Mercurial ? Or your Maven repository ?
If it is your Maven repository, you want to synchronize your local repository with your remote repository ?