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--------------
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--------------
- Go to the Java Build Path (right click on your project in the navigator -> properties -> Java Build Path -> Libraries)
- Edit the “ANDROID_SDK_PLATFORM/android.jar” entry
- Click the “Variable” Button and add a new Variable called “ANDROID_SDK_PLATFORM” and your android platform folder as the desired path
- 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
- change from Java Build Path to “Builders”
- Create a new Ant Builder and add the build.xml into “Buildfile” and select the project itself as Base Directory.
- Change to Tab “Target and click “Set Targets…” at the Manual Build Option
- Check “jar” in the selection and close with ok. There should be in the Manual Build: “build, jar”.
- Click Ok and be sure to have the new Ant builder active and the java Builder INACTIVE
- Open “build-jar.xml and delete in line 32 the following “depends=”version”
- Delete on line 37 “.r${version}
- Change on line 43 “destfile” to the folder where you want the Jar file to be created.
- Open build.xml and change the following lines
- 9 – at the value field enter your android platform folder
- 10 – at value enter your eclipse folder
- 16 and 17 – be sure the path and filename of the JUnit files are correct
- 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.
0 comments: