function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vinod VishwakarmaVinod Vishwakarma 

Smartstore Syncdown Issue In Android Native App Using SyncManager

Hi SFDC Team,

I have created the soup in my native android app. the soup created successfully but when i am trying to sync down the data from serve to local it says  this error : com.salesforce.androidsdk.smartstore.store.SmartSqlHelper$SmartSqlException: tm_accounts does not have an index on __local__ at character 49

tm_accounts -> this is my soup name

code snippet.



 private void syncDownTMAccount() {
        SyncDownTarget target = new SoqlSyncDownTarget("SELECT  product_amount__c, tm_type__c, Date__c, tm_phone__c FROM "+SoupName.TMACCOUNT_SOUP__);

        try {

            DebugLog.d("SyncDownTarget=="+target.asJSON());
 
            SyncManager.getInstance().syncDown(target, options, SoupName.TMACCOUNT_SOUP, new SyncManager.SyncUpdateCallback() {
                @Override
                public void onUpdate(SyncState sync) {
                    try {

                        sync.save(mSmartStore);

                        DebugLog.d("Sync Down updated");
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                }
            });

        } catch (JSONException e) {
            Log.e(TAG, "JSONException occurred while parsing", e);
        }
    }


When i call this method below error comes. Can any one help me that.

com.salesforce.androidsdk.smartstore.store.SmartSqlHelper$SmartSqlException: tm_accounts does not have an index on __local__ at character 49








 
Vinod VishwakarmaVinod Vishwakarma
After lot of docs reading for salesforce i found the solutions. Basically i am missing the permission while define the soup specs.

 Just add the below code in your index specs

new IndexSpec(SyncManager.LOCALLY_CREATED, SmartStore.Type.string),
new IndexSpec(SyncManager.LOCALLY_UPDATED, SmartStore.Type.string),
new IndexSpec(SyncManager.LOCALLY_DELETED, SmartStore.Type.string),
new IndexSpec(SyncManager.LOCAL, SmartStore.Type.string)