2016-11-02 2 views
-1

Ich benutze Couchbase für mein Projekt. Nun, das ist mein erstes Mal mit Couchbase Lite für Android. Ich erhalte derzeit diesen Fehler. Aber ich bestanden die richtige URL für die JSON Api finden Sie es hierAndroid Couchbase Fehler bekommen Remote Checkpoint

http://query.yahooapis.com/v1/public/yql?q=select+*+from+yahoo.finance.historicaldata+where+symbol+%3D+%22YHOO%22+and 
+startDate+%3D+%222015-11-02%22+and+endDate+%3D+%222016-11-02%22&format=json&diagnostics=true&env=store%3A%2F 
%2Fdatatables.org%2Falltableswithkeys&callback= 

Aber im LogCat finde ich diese JSON URL:

http://query.yahooapis.com/v1/public/yql?q=select+*+from+yahoo.finance.historicaldata+where+symbol+%3D+%22YHOO%22+and 
+startDate+%3D+%222015-11-02%22+and+endDate+%3D+%222016-11-02%22&format=json&diagnostics=true&env=store%3A%2F 
%2Fdatatables.org%2Falltableswithkeys&callback=/_local/a26bc8baaf06fc3d4d08c9b916d2a8508152b2fa 

Dies ist LogCat Fehler Ich erhalte.

11-02 18:28:58.832 29526-29670/com.android.stockhawk W/Sync: 

[email protected]: error getting remote checkpoint com.fasterxml.jackson.core.JsonParseException: Unexpected character ('/' (code 47)): maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser) at [Source: buffer([email protected]).inputStream(); line: 1, column: 2] at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1486) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:518) at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:447) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._skipComment(UTF8StreamJsonParser.java:2902) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._skipWSOrEnd2(UTF8StreamJsonParser.java:2781) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._skipWSOrEnd(UTF8StreamJsonParser.java:2737) at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:652) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3600) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3545) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2646) at com.couchbase.lite.replicator.RemoteRequest.executeRequest(RemoteRequest.java:275) at com.couchbase.lite.replicator.RemoteRequest.execute(RemoteRequest.java:165) at com.couchbase.lite.replicator.RemoteRequest.run(RemoteRequest.java:105) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) at java.lang.Thread.run(Thread.java:818)

Dies ist mein Code für Couchbase

public void storeStockHistoryData(String stock_symbol){ 
     try { 

      manager = new Manager(new AndroidContext(mContext.getApplicationContext()), Manager.DEFAULT_OPTIONS); 
      DatabaseOptions options = new DatabaseOptions(); 
      options.setCreate(true); 
      database = manager.openDatabase(Constants.DATABASE_NAME, options); 
      com.couchbase.lite.View viewItemsByDate = database.getView("quote"); 
      viewItemsByDate.setMap(new Mapper() { 
       @Override 
       public void map(Map<String, Object> document, Emitter emitter) { 
        Object createdAt = document.get("Symbol"); 
        if (createdAt != null) { 
         emitter.emit(createdAt.toString(), null); 
         Log.d(LOG_TAG, "Fetched Data: " + createdAt.toString()); 
        } 
       } 
      }, "1.0"); 

      startSync(stock_symbol); 

     }catch (Exception e){ 
      e.printStackTrace(); 
     } 
    } 

    private void startSync(String stockSymbol) { 

     String url = Utils.getStockDataUrl(stockSymbol); 
     URL syncUrl; 
     try { 
      syncUrl = new URL(url); 
     } catch (MalformedURLException e) { 
      throw new RuntimeException(e); 
     } 

     Replication pullReplication = database.createPullReplication(syncUrl); 
     pullReplication.setContinuous(true); 

     Replication pushReplication = database.createPushReplication(syncUrl); 
     pushReplication.setContinuous(true); 

     pullReplication.start(); 
     pushReplication.start(); 

     pullReplication.addChangeListener(this); 
     pushReplication.addChangeListener(this); 

    } 

mir bitte helfen herauszufinden, was das Problem ist, wie ich auch wenig Zeit für meine Projekteinreichung laufen werde.

Antwort

1

Es scheint, dass Sie versuchen, mit Ihrer Anwendung gegen Yahoo REST API zu synchronisieren. Aber Couchbase Lite unterstützt nicht die Replikation gegen Yahoo REST API oder andere REST APIs. Couchbase Lite bietet die Replikation mit Couchbase Server über SyncGateway oder CouchDB (einschließlich Cloudant).