我正在使用 mbtiles4j在 Android 应用程序中编写器以在 AsyncTask 类中创建一个新的 .mbtiles 文件。
这是我的java代码:
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;
}
}
Windows 10 x64 位的完整错误报告。 http://pastebin.com/raw/fhSH8qJr
build.gradle 看起来如下
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 实际上包含在我的项目中:见截图。通过 build.gradle 包含它还有其他问题,所以我设法像这样解决它。 mbtilesreader 工作正常!
编辑:禁用即时运行,错误代码现在是:找不到“libsqlitejdbc.so”
最佳答案
解决方案感谢@Morrison Chang 和@cCOOK
我不得不为特定的 Android 实现重写 MBTilesWriter。 Check it out here
关于java - MBTilesWriter java.lang.UnsatisfiedLinkError slice-sqlite-jdbc-3.8.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41509607/