Offline Editor Sync Method doesn’t allow to Sync only required layers in the code

3814
4
08-26-2014 03:51 AM
RajeshMane
New Contributor

We are working on ArcGIS Android APIs for Offline Editor application , Which downloads the data in and synchronizes the same data in online mode. As per API ,In Sync module(SyncGeodatabaseParamsà LayerSyncInfo) there are certain options which allows layers to be  ignored during the sync. We have observed API given by ESRI, doesn’t allow compile the below mentioned function(indirect reference Issue). Hence Sync method fails to upload the data which is captured in offline mode.

Following url gives APIs reference for Sync Model

https://developers.arcgis.com/android/api-reference/reference/com/esri/core/tasks/geodatabase/SyncGe...

https://developers.arcgis.com/android/api-reference/reference/com/esri/core/tasks/geodatabase/SyncGe...

Code Snippet implemented for excluding layers from Sync operation

SyncGeodatabaseParameters syncParams = geodatabase.getSyncParameters(); syncParams.setSyncLayers(new LayerSyncInfos()); (This Line is not getting compiled and getting following error also shown in snapshot)

The type com.esri.core.internal.tasks.f cannot be resolved. It is indirectly referenced from required .class files

The similar issue also raised in ESRI forum but seems to be unresolved (Below link).  Since it vital requirement very crucial for mobile app , please suggest any alternative approach or resolution of this bug from the product support.

https://community.esri.com/thread/103206

Resolution tried from our side:

·         We have re-loaded 10.2.3 JAR files from Java Build path but resulted in same issue.

0 Kudos
4 Replies
DanO_Neill
Occasional Contributor III

As in the post your reference, most likely your project is not set up correctly as the class in the jar is dependent on native libs being present.  Try the following: 

First confirm your project is an ArcGIS Android Project

> Right Click your project and choose ArcGIS Tools

> If Convert to ArcGIS Android Project is enabled select that tool to ensure your project has all dependent libraries.

> if Convert to ArcGIS Android Project is not enabled (greyed out), then select Fix Project Properties to ensure your project has all dependent libraries. 

0 Kudos
RajeshMane
New Contributor

Dear Dan,

Thanks for quick support. We have tried the resolution provided as in given steps.But ,we  are getting error of build path for two specific set methods for this class whereas others two are working fine

Error:

The type com.esri.core.internal.tasks.f cannot be resolved. It is indirectly referenced from required .class files

methods has errors

  1. syncParams.setSyncLayers
  2. syncParams.setSyncDirection ()

Methods getting compiled without errors

  1.        syncParams.setGeodatabaseId()
  2.        syncParams.setUploadId()

SyncGeodatabaseParameters syncParams = geodatabase.getSyncParameters();

syncParams.setSyncLayers(new LayerSyncInfos());

As per our knowledge, this error could be due order in which various android as well as ArcGIS .jar files are maintained in Eclipse or could be API issue.

Please revert If you come across anything helpful.

0 Kudos
DanO_Neill
Occasional Contributor III

I am looking to see if I can reproduce, in the mean time can you send me the exact code snippet you are using?  Where are you setting the code snippet in the sample?

0 Kudos
RajeshMane
New Contributor

Here is source code. Do let us know If you need anything

// get sync parameters from geodatabase

                     final SyncGeodatabaseParameters syncParams = gdb.getSyncParameters();

                     CallbackListener<Map<Integer, GeodatabaseFeatureTableEditErrors>> syncResponseCallback = new CallbackListener<Map<Integer, GeodatabaseFeatureTableEditErrors>>() {

                           public void onCallback(Map<Integer, GeodatabaseFeatureTableEditErrors> objs) {

                                  if (objs != null) {

                                         if (objs.size() > 0) {

                                         } else {

                                                showMessage(activity, "Synchronization Completed");

                                         }

                                  } else {

                                         showMessage(activity, "Synchronization Completed");

                                  }

                           }

                           @Override

                           public void onError(Throwable e) {

                                  showMessage(activity, e.getMessage());

                           }

                     };

                     GeodatabaseStatusCallback statusCallback = new GeodatabaseStatusCallback() {

                           @Override

                           public void statusUpdated(GeodatabaseStatusInfo status) {

                                  if (status.getStatus().toString() == "Completed") {

                                         currentCount++;

                                         if (totalCounts == currentCount) {

                                                      

  1. OfflineEditorActivity.handler.sendEmptyMessage(2);

                                                currentCount = 0;

                                         }

                                  } else if (status.getStatus().toString() == "Failed") {

                                         currentCount++;

                                         if (totalCounts == currentCount) {

                                                currentCount = 0;

                                                OfflineEditorActivity.handler.sendEmptyMessage(0);

                                                Intent goSyncDashboard = new Intent(activity, MapDashboard.class);

                                                activity.startActivity(goSyncDashboard);

                                                activity.finish();

                                         }

                                  }

                                  showMessage(activity, status.getStatus().toString());

                           }

                     };

                    

                    

                     LayerSyncInfo jhkhjkf = syncParams.getSyncLayers().get(0);

                    

                     LayerSyncInfo lsiWFAP = new LayerSyncInfo();

                     lsiWFAP.setLayerId(syncParams.getSyncLayers().get(0).getLayerId());

                    

                     LayerSyncInfo lsiBuilding = new LayerSyncInfo();

                     lsiBuilding.setLayerId(syncParams.getSyncLayers().get(1).getLayerId());

                     lsiBuilding.setSyncDirection(SyncDirection.NONE);

                    

                     LayerSyncInfo lsiLandmark = new LayerSyncInfo();

                     lsiLandmark.setLayerId(syncParams.getSyncLayers().get(2).getLayerId());

                     lsiLandmark.setSyncDirection(SyncDirection.NONE);

                    

                     LayerSyncInfo lsiRoad = new LayerSyncInfo();

                     lsiRoad.setLayerId(syncParams.getSyncLayers().get(3).getLayerId());

                     lsiRoad.setSyncDirection(SyncDirection.NONE);

                    

                     LayerSyncInfo lsiRail = new LayerSyncInfo();

                     lsiRail.setLayerId(syncParams.getSyncLayers().get(4).getLayerId());

                     lsiRail.setSyncDirection(SyncDirection.NONE);

                    

                     LayerSyncInfos lsi = new LayerSyncInfos();

                     lsi.add(lsiWFAP);

                     lsi.add(lsiBuilding);

                     lsi.add(lsiLandmark);

                     lsi.add(lsiRoad);

                     lsi.add(lsiRail);

                    

                     // Error occured in below line of code

                    

                     syncParams.setSyncLayers(lsi);

                                         

                     // start sync...

                     gdbTask.syncGeodatabase(syncParams, gdb, statusCallback, syncResponseCallback);

              } catch (Exception e) {

                     e.printStackTrace();

              }

       }

0 Kudos