Unfolding Maps in Android

edited August 2016 in Android Mode

Hello, I'm checking out Unfolding Maps in Android mode, trying the SimpleMapApp example in the installation. (Runs in Java mode for me with no problems.)

I'm using Processing 2.2.1 (Processing 3.x is similar), exporting to Nexus 7 (2012) running Android 4.4.2. So far all the other Processing-Android libraries etc I've tried work fine. But the SimpleMapApp gives me this error message:

Unfolding Map v0.9.6 No OpenGL renderer. Using Java2DMapDisplay. FATAL EXCEPTION: Thread-923 Process: processing.test.simplemapapp, PID: 30496 java.lang.NoSuchMethodError: processing.core.PApplet.loadImage at de.fhpotsdam.unfolding.tiles.TileLoader.getTileFromUrl(Unknown Source) at de.fhpotsdam.unfolding.tiles.TileLoader.run(Unknown Source) at java.lang.Thread.run(Thread.java:841)

After TileLoader.java in the source distribution, looks like this (and another call to loadImage) is the problem:

PImage img = p.loadImage(urls[0], "unknown");

Is there a version of Unfolding Maps with this fixed? Before I try to tinker with it and recompile the library…

Thanks! Bill



  • Yes, that seems to be the problem. There is no Android version of Unfolding (at least no official or current one - there is this fork).

    Could you try changing it for yourself and see if it works? (I also tried it once but as I don't have an Android device I cannot test it myself. See https://github.com/tillnagel/unfolding/blob/master/src/de/fhpotsdam/unfolding/tiles/TileLoader.java#L97 )

  • Thanks Till! I checked out the Android fork; unfortunately it's for Processing 1.x. Brian at occurrentarts said he currently has no plans to update it.

    Let me tweak the source, and try to figure out how to compile the unfolding library…


  • HI, this works in my Android, be sure to check "internet" in sketch permission

     * An application with a basic interactive map. You can zoom and pan the map.
    import de.fhpotsdam.unfolding.*;
    import de.fhpotsdam.unfolding.geo.*;
    import de.fhpotsdam.unfolding.utils.*;
    import de.fhpotsdam.unfolding.providers.*;  //new
    import de.fhpotsdam.unfolding.mapdisplay.MapDisplayFactory;  //new
    UnfoldingMap map;
    void setup() {
      size(800, 600); //modified without P2D
      map = new UnfoldingMap(this);
      map.zoomAndPanTo(new Location(52.5f, 13.4f), 10);
      MapUtils.createDefaultEventDispatcher(this, map);
    void draw() {
    //check this: Android--> Sketch Permission-->Internet
  • Thanks Camperos! Unfortunately I get the same error on my Nexus 7 (2012) running Android 4.4.2. What device are you testing the sketch on?

  • tested with samsung S2, Android 4.1.2

  • with samsung S4, Android 4.4.2, no error but doesn't works

  • edited March 2015

    Samsung S4 Android 4.4.2, with "SimpleMakerAPP" it works, without P2D, remember in sketch permission flag "internet"

    import de.fhpotsdam.unfolding.*;
    import de.fhpotsdam.unfolding.geo.*;
    import de.fhpotsdam.unfolding.utils.*; 
    UnfoldingMap map;
    Location locationBerlin = new Location(52.5f, 13.4f);
    Location locationLondon = new Location(51.5f, 0f);
    public void setup() {
      size(800, 600 ); //without P2D
      map = new UnfoldingMap(this);
      map.panTo(new Location(40f, 8f));
      MapUtils.createDefaultEventDispatcher(this, map);
    public void draw() {
      // Draws locations on screen positions according to their geo-locations.
      // Fixed-size marker
      ScreenPosition posBerlin = map.getScreenPosition(locationBerlin);
      fill(0, 200, 0, 100);
      ellipse(posBerlin.x, posBerlin.y, 20, 20);
      // Zoom dependent marker size
      ScreenPosition posLondon = map.getScreenPosition(locationLondon);
      fill(200, 0, 0, 100);
      float s = map.getZoom();
      ellipse(posLondon.x, posLondon.y, s, s);
  • Camperos, thanks for checking all the devices! I tried both your new sketch, and the original version again, on my Google Nexus 7 (2012) and a Samsung Galaxy Nexus running Android 4.3; still getting the same errors with loadImage().

    I'll try to find another device to test on. Now I'm suspecting it might be my Processing setup that's an issue. I'm trying both Processing 2.2.1 and 3.x; same problems with both.

  • edited March 2015

    my pc has processing 2.1.1 SDK build tools 19.1, I tested with another pc with Processing 2.2.1, SDK build tools 21

    another sketch unfolding for certificate problems, sketch without P2D, highlighted "Internet" in sketch permission, samsung 4.2.2 highlighted "debug" and it works

  • Thanks Camperos! I'm on MacOS 10.8. I think it's a Processing issue. Let me try to figure out how to recompile the Unfolding library…

  • @camperos && @billhsu::

    android kitkat, osX 10.6.8, sonyXperia Z: no error but the app is not installed & nothing happens

  • (windows 8.1) last part of debugging processing:

        Unfolding Map v0.9.5
        No OpenGL/P2D set. Using Java2DMapDisplay.
  • edited March 2015
    1. Maybe the loadImage() method for Android takes only one argument ?
    2. size() is not good for Android, try removing it, and you can try adding something like: public String sketchRenderer(){ return OPENGL; }
  • @camperos: exactly the same post build- debug message... but nothing in the phone where i can see that, though it is said "launched successfully" the app does not work; trying to install it manually on the phone then starting from it: fails immediately on launching...I will try with another phone (samsung galaxy running 4.2)

  • I'm still guessing it's a Processing/Mac issue. Let me try to figure out how to recompile Unfolding...

  • I'm using Processing 2.something to export android mode. I then use Android Studio to actually finish writing my apps. I downloaded the Unfolding for Processing and the ModestMaps which is where Unfolding started. I stuck the src into my lib folder for my project in Android Studio and then imported from there. I remember ModestMaps caused an error and I just edited a line out with a comment and it still worked. The map it would draw was nice. I tried the same thing with Unfolding and it works too. I don't remember if there was an error with the src. I remember I was ready for it though.

    Anyway, the problem I have with Unfolding on android is when I map.draw, I get the tiles like it should but it keeps redrawing and loading the tiles. Its annoying. ModestMaps only redraws/loads the tiles when I zoom. The problem with ModestMaps is I cant control both the size and screen location of the map. It just uses the whole screen no matter what. I tried Unfolding to control size and location, but it just looks like a random patch of tiles and every so often I get the whole map.

  • Whoops, my comment above is not entirely accurate. I got Unfolding working nicely in a Processing Papplet in android. I tried it so that I could control the size and location of the map, while ModestMaps wont allow Me to do that. There is still a problem though and that is when I draw all kinds of other typical processing stuff, the map constantly redraws/reloads the tiles. That's the annoying part. It does not do that when the only thing draw does is map.draw.

    Also, I put the Unfolding src in my Android studio projects src directory and not the lib directory. If I knew how to compile it into a .jar I'd put it in libs. My android tablet is running lollipop and might be why I got it running fairly easily, don't know.

Sign In or Register to comment.