1

im using the mbtiles4j writer inside an Android App to create a new .mbtiles file in an AsyncTask class.

Here is my java code:

private class FetchData extends AsyncTask<String, Void, String> {
  private Exception exception;

  @Override
  protected String doInBackground(String... routeSelected) {
    MBTilesWriter w = null;
    String filePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/MyRoutes/" + routeSelected;
    try {
      outputFile = new File(filePath);
      w = new MBTilesWriter(outputFile);
      new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/MyRoutes").mkdirs();
    } catch (MBTilesWriteException e) {
      this.exception = e;
      System.out.println("exception: " + e);
      return "";
    }

    //Irrelevant code removed here...

    return filePath;
  }
}

Full error report on windows 10 x64 bit. http://pastebin.com/raw/fhSH8qJr

build.gradle looks as follows

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //compile 'org.imintel:mbtiles4j:1.0.5'
    compile 'org.xerial:sqlite-jdbc:3.8.7'
    compile 'commons-io:commons-io:2.5'

mbtiles4j is actually included inside my project: see screenshot. There were other problems with including it through build.gradle, so I managed to workaround it like this. The mbtilesreader works fine!

Edit: disabled instant run, error code is now: couldn't find "libsqlitejdbc.so"

android studio

user3586358
  • 99
  • 1
  • 9

1 Answers1

1

Solution thanks to @Morrison Chang and @cCOOK

I had to rewrite the MBTilesWriter for specific Android implementation. Check it out here

user3586358
  • 99
  • 1
  • 9