Search code examples
javaandroideclipseosmdroid

how could I change osmdroid-android-4.1 to osmdroid-android-4.2 in existing android app


I have an existing android app that uses the osmdroid-android-4.1.

Now I want to use the new osmdroid-android-4.2. Therefor I have copied the JAR files (osm-android-4.2.jar and osmdroid-android--javadoc.jar) into the folder "lib" and deleted the old physically JAR files.

Now my project contains errors.

Under "Fix project setup..." for the error "ISafeCanvas cannot be resolved to a type" it says: Add archive 'osmdroid-android-4.1.jar'.

For example another errors:

  • The method toMapPixelsProjected(int, int, Point) is undefined for the type Projection PathOverlay2.java
  • The method fromPixels(int, int) in the type Projection is not applicable for the arguments (float, float)

How could I resolve these problems?

Where can I have a look at the difference between the version 4.1 and 4.2? How could I know, what I have to change in my app? How can I guarantee that the app is still working like before?


edit #1:

(right click - source - clean up ...) Under the radio button "use configured profiles I have selected my project. (click on next) Under "changes to be performed" I have selected all. (click on finish) But the errors still exists.


edit #2:

I have changed these methods: renamed some projection methods

  • fromMecatorPixels -> toPixelsFromMercator
  • toPixelsProjected -> toProjektedPixels
  • toPixelsTranslated -> toPixelsFromProjected
  • toMapPixels -> toPixels

But I can't find the new names of these methods:

  1. fromPixels
  2. fromPixelsToProjected

Solution

  • I have changed these methods (old -> new):

    • fromMecatorPixels -> toPixelsFromMercator
    • toPixelsProjected -> toProjektedPixels
    • toPixelsTranslated -> toPixelsFromProjected
    • toMapPixels -> toPixels
    • fromPixels(double, double) -> fromPixels((int)double, (int)double)
    • Rect clipBounds = projection.fromPixelsToProjected(projection.getScreenRect()); -> Rect clipBounds = projection.getScreenRect();

    Following links are useful to see the difference between the versions:


    Until now the app opens the map with no errors. I hope I will have fixed all problems.