arcgis runtime sdk for android 数据离线出错:the database disk image is malformed
参考官方的OfflineEditor例子,数据能离线成功,而且有时候不出现该错误。
/**
* Download the geodatabase from the server.
*/
private static void requestGdbFromServer(GeodatabaseSyncTask geodatabaseSyncTask,
final Activity activity, final MapView mapView, FeatureServiceInfo fsInfo, final Geometry geometryExtent) {
GenerateGeodatabaseParameters params = new GenerateGeodatabaseParameters(fsInfo, geometryExtent,
mapView.getSpatialReference(), null, true);
params.setOutSpatialRef(mapView.getSpatialReference());
// gdb complete callback
CallbackListener<String> gdbResponseCallback = new CallbackListener<String>() {
@Override
public void onCallback(String path) {
// add local layers from the geodatabase
addLocalLayers(mapView, path, activity);
showMessage(activity, "离线数据可用!", MyToast.INFO);
showProgress(activity, false);
}
@Override
public void onError(Throwable e) {
Log.e(TAG, "", e);
showMessage(activity, "请求离线数据失败:" + e.getMessage(), MyToast.ERROR);//这里出错:java.lang.runtimeException the database disk image is malformed
showProgress(activity, false);
}
};
出错原因是加载下载好的数据方法
addLocalLayers(mapView, path, activity);
里:geodatabase = new Geodatabase(gdbPath);出错。gdbPath没有问题,就是偶尔这句话会出错,提示:the database disk image is malformed。
0 个回复