Modifying OsmDroid in Android

Modifying OsmDroid in Android. 

Inorder to Modify osmdroid,we have to import it first.



How to import osmdroid-android project ?

While importing osmdroid-androi source,there may occur errors.
 So to avoid wastage of time ,we have to create a new java project "osmdroid-android" and place all files in "src" in the order it is from google svn checkout.
There contains other files like assets,bin etc and copy /create that also.Sometimes you have to import android.jar also.


After doing this ,suppose if we want a jar of this....

Follow the steps--------------
  1. Go to the Java Build Path (right click on your project in the navigator -> properties -> Java Build Path -> Libraries)
  2. Edit the “ANDROID_SDK_PLATFORM/android.jar” entry
  3. Click the “Variable” Button and add a new Variable called “ANDROID_SDK_PLATFORM” and your android platform folder as the desired path
  4. Back at the Build Path Libraries look inside the folder”JUnit 4″ and write down the filename of hamrest.core and the path of the junit.jar file – we’ll need them later
  5. change from Java Build Path to “Builders”
  6. Create a new Ant Builder and add the build.xml into “Buildfile” and select the project itself as Base Directory.
  7. Change to Tab “Target and click “Set Targets…” at the Manual Build Option
  8. Check “jar” in the selection and close with ok. There should be in the Manual Build: “build, jar”.
  9. Click Ok and be sure to have the new Ant builder active and the java Builder INACTIVE
  10. Open “build-jar.xml and delete in line 32 the following “depends=”version”
  11. Delete on line 37 “.r${version}
  12. Change on line 43 “destfile” to the folder where you want the Jar file to be created.
  13. Open build.xml and change the following lines
  14. 9 – at the value field enter your android platform folder
  15. 10 – at value enter your eclipse folder
  16. 16 and 17 – be sure the path and filename of the JUnit files are correct
  17. Run and hope that you get a Jar file at the end


Another Method for Creating Jar in Android
Select "osmdroid-android" project and click "Export".
In this,select "Java"-> "jar" and select what all files you want in your jar and 
finally  specify the destination path.

After creating the Modified Osmdroid jar,you can directly use in Android Project.