Coder Social home page Coder Social logo

todolite-android's Introduction

**This repository is in the process of being deprecated. See the Android TODO app in the training documentation for a more up-to-date sample.

ToDo Lite for Android

Join the chat at https://gitter.im/couchbase/mobile

A shared todo app that shows how to use the Couchbase Lite Android framework to embed a nonrelational ("NoSQL") document-oriented database in an Android app and sync it with Couchbase Server in a public or private cloud.

screenshot

Get the code

$ git clone https://github.com/couchbaselabs/ToDoLite-Android.git
$ cd ToDoLite-Android

Build and run the app

  • Import the project into Android Studio by selecting build.gradle or settings.gradle from the root of the project.
  • Run the app using the "play" or "debug" button.

Point to your own Sync Gateway

  1. Download Sync Gateway.

  2. Start Sync Gateway with the configuration file in the root of this project.

    ~/Downloads/couchbase-sync-gateway/bin/sync_gateway sync-gateway-config.json
  3. Open Application.java and update the SYNC_URL_HTTP constant to point to your Sync Gateway instance.

    private static final String SYNC_URL_HTTP = "http://localhost:4984/todolite";

    You can use the adb reverse tcp:4984 tcp:4984 command to open the port access from the host to the Android emulator. This command is only available on devices running android 5.0+ (API 21).

  4. Log in with your Facebook account.

  5. Add lists and tasks and they should be visible on the Sync Gateway Admin UI on http://localhost:4985/_admin/.

Community

If you have any comments or suggestions, please join our forum and let us know.

License

Released under the Apache license, 2.0.

Copyright 2011-2014, Couchbase, Inc.

todolite-android's People

Contributors

devexter avatar hideki avatar jamesnocentini avatar pasin avatar sethrosetter avatar tleyden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

todolite-android's Issues

ToDo Lite 1.0.3 on Play store (and also ToDo Lite iOS) is unable to sync

The ToDo application on the Google Play store (and Apple app store) are both no longer able to sync.

I assume something has gone wrong with the back-end sync gateways.

Confirmed on 2 android and 1 iOS device.
This is the version directly from the stores, and has not been compiled locally.

Steps to reproduce:

  1. Install ToDo Lite in either Android or iOS.
  2. Login
  3. Application does not sync

Multiple times update doc crash :com.couchbase.lite.CouchbaseLiteException: Conflicts not allowed and there is already an existing doc with id: 129047

I have create document, and then i have update document multiple times.but crash,

  public final void saveOrUpdate()
{
  // Create document if required
        if (mDocument == null) {
            mDocument = database.getDocument(getDocumentUniqueId());
            UnsavedRevision revision = mDocument.createRevision();
            revision.setUserProperties(mProperties);
            revision.save();
        }else{
            // com.couchbase.lite.CouchbaseLiteException: Conflicts not allowed and there is already an existing doc with id: 129047
            mDocument.putProperties(mProperties);
        }
}

Why ???
How to update a document???
Thanks

A Task List, which is created without sign in Facebook, is not synchronized.

Steps to reproduce:

  1. Buid ToDoLite-Android with following instruction, and run it with emulator.
  2. Create Task List *without sign in Facebook".
  3. Log in Facebook, you can also see some tasks which are synchronized through Sync-Gateway in addition to the task list you just created.
  4. Build ToDoLite-iOS with following instruction and run it with emulator.
  5. Newly created task list from Android should be listed. But it is not.

Note: it seems Android demo app issue. Pasin is looking into it.

Unable to build ToDoLite-Android

Hi,

I am using Android Studio 0.8.2 and I am trying to build ToDoLite-Android.

I followed the procedure from,

http://developer.couchbase.com/mobile/get-started/get-started-mobile/android/building-todo-lite/index.html

I changed the Android Gradle plugin version as the IDE forced me to set in build.gradle,
classpath 'com.android.tools.build:gradle:0.12.+'

I am getting the following error while building,

Error:A problem occurred configuring project ':ToDoLite'.

A problem occurred configuring project ':libraries:couchbase-lite-android'.
java.lang.NullPointerException (no error message)

I would like to know and rectify if I am missing anything while building.

Thank you.

Facebook single signon doesn't work

Just saw this trying to install on @mschoch's device, and I've seen it before.

I don't have the logs, but it's trivial to reproduce:

  • Install facebook app and login
  • Install TodoLite from scratch.
  • Login

It will give errors in the logs, and no errors in the UI.

What is the purpose of Guest login?

This sample app presents two entry points: Facebook login, and Guest login. They're presented as hierarchically equivalent actions on the first screen, which doesn't imply that they will have intentionally different functionality.

However, in attempting to evaluate whether or not Couchbase Lite suits my team's needs, I spent a large amount of time trying to make the app communicate with my local Sync Gateway. Nothing worked; Sync Gateway wouldn't even show error messages, and I was really starting to come away with the impression that it was an unreliable product with incomplete documentation.

As a last ditch effort, I attempted to run the app using Facebook authentication and it immediately worked as expected. This leaves me with several questions:

  • Does guest login even do anything network-related? If yes, why didn't it work? If no, why is it even an option?
  • Why depend on Facebook login for your sample app? Not everyone wants to give access to such a personal source of information in order to test out a product that doesn't inherently need that information.
  • If the dependency on Facebook is absolutely required, why does README.md contain no mention of this?

At the very least, this issue could be rectified by clarifying in the instructions that using a local Sync Gateway requires the user to use the Facebook login option.

ToDoLite App crashes when try to solve conflict

01-27 15:08:53.240 14408-14478/com.couchbase.todolite E/Sync: com.couchbase.lite.replicator.ReplicationInternal$4@a3a9dba checkSessionAtPath() response: {authentication_handlers=[default, cookie], ok=true, userCtx={channels={!=1, list--1tjXG7NdbnoOG5uc6PIAf_=342, list--3DDqm0tNk403A033gAoS5G=22, list--96wjLm14TKm1eSuhNm_9u6=349, list--Cc8FLya2NdkFTQwendrTkE=355, list--F0aINYoKC1NDBTgMsL68VZ=366, list--HMw4RYkuzfnfruhLKzu18p=312, list--Ohx7JyeWC-y5WNqJUdrg8F=374, list--Q7JeekycuhpVWOJQDOijw8=370, list--YVoGr7glXfL22iGIXmGGNj=40, list--_SJZ2R8EUGiG-7caDl9YYG=375, list--n237SCCtOwgPCZvXT8e7Rj=174, list--qlIdKUEBimptJbN0DOzPwu=13, list--xcaO5lqOtdUk3iP1bah7sJ=137, list-a8fbaac8-4bea-452a-8ab8-04e75736dcf3=119, list-f0cf15a4-a5eb-4335-8646-9ba42590cd76=303, profiles=2}, name=1398835190428562}}
01-27 15:09:32.567 14408-14408/com.couchbase.todolite E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.couchbase.todolite, PID: 14408
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
        at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1044)
        at java.text.DateFormat.parse(DateFormat.java:577)
        at com.couchbase.todolite.ConflictsAdapter.getView(ConflictsAdapter.java:46)
        at android.widget.AbsListView.obtainView(AbsListView.java:2346)
        at android.widget.ListView.makeAndAddView(ListView.java:1876)
        at android.widget.ListView.fillDown(ListView.java:702)
        at android.widget.ListView.fillFromTop(ListView.java:763)
        at android.widget.ListView.layoutChildren(ListView.java:1685)
        at android.widget.AbsListView.onLayout(AbsListView.java:2148)
        at android.view.View.layout(View.java:16636)
        at android.view.ViewGroup.layout(ViewGroup.java:5437)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
        at android.view.View.layout(View.java:16636)
        at android.view.ViewGroup.layout(ViewGroup.java:5437)
        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
        at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
        at android.view.View.layout(View.java:16636)
        at android.view.ViewGroup.layout(ViewGroup.java:5437)
        at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
        at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
        at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
        at android.view.View.layout(View.java:16636)
        at android.view.ViewGroup.layout(ViewGroup.java:5437)
        at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2171)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1931)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
        at android.view.Choreographer.doCallbacks(Choreographer.java:670)
        at android.view.Choreographer.doFrame(Choreographer.java:606)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Upgrade Facebook SDK to 4.0

The new facebook SDK 4.0 does simplify login steps and get rid of all confusing session states. We should upgrage.

CursorWindow﹕ not growing since there are already 943 row(s), max size 1048576

11-12 20:31:37.134 26764-26780/com.eusoft.recite.fr I/CBLite﹕ Thread-1071 Begin transaction (level 1)
11-12 20:31:37.134 26764-26780/com.eusoft.recite.fr I/CBLite﹕ Thread-1071 Committing transaction (level 1)
11-12 20:31:37.174 26764-26764/com.eusoft.recite.fr D/libEGL﹕ loaded /system/lib/egl/libEGL_tegra.so
11-12 20:31:37.184 26764-26764/com.eusoft.recite.fr D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_tegra.so
11-12 20:31:37.194 26764-26780/com.eusoft.recite.fr D/CBLite﹕ Query view CountTotalAllCardByBookId completed in 64 milliseconds
11-12 20:31:37.194 26764-26764/com.eusoft.recite.fr D/libEGL﹕ loaded /system/lib/egl/libGLESv2_tegra.so
11-12 20:31:37.234 26764-26764/com.eusoft.recite.fr D/OpenGLRenderer﹕ Enabling debug mode 0
11-12 20:31:38.104 26764-26780/com.eusoft.recite.fr E/CursorWindow﹕ need to grow: mSize = 1048576, size = 691, freeSpace() = 494, numRows = 943
11-12 20:31:38.104 26764-26780/com.eusoft.recite.fr E/CursorWindow﹕ not growing since there are already 943 row(s), max size 1048576
11-12 20:31:38.104 26764-26780/com.eusoft.recite.fr E/Cursor﹕ Failed allocating 691 bytes for text/blob at 942,8
11-12 20:31:38.144 26764-26780/com.eusoft.recite.fr D/Cursor﹕ finish_program_and_get_row_count row 367

Add conflict resolution

It would be nice to display a mark in the cell when a Task has conflicting revisions.
When the user clicks on the mark, then open a new Screen/Activity, display both revisions and let the user pick the winner.

Actions:

  • In the method setting up the cell in the list view, add logic to detect if this task has conflicting revisions.
final Document task = (Document) getItem(position);
if (task.getConflictingRevisions().size() > 0) {
    // show conflict marker
}
  • add onClickListener on the marker button to show new activity with the list of conflicting revisions.
  • when user picks a revision, delete all the other ones. This will cause the remaining revision to be the current revision
// x: number of the revision picked in the list showed to the user
SavedRevision pickedRevision = task.getConflictingRevisions().get(x);
for (SavedRevision rev : task.getConflictingRevisions()) {
    if (rev.equals(pickedRevision)) {
        // do nothing
    } else {
        rev.deleteDocument();
    }
}

See conflict resolution guide

There is also the possibility to do auto merging when userProperties do not conflict. I don't think that's a use case for Todo Lite yet though since the schema is always the same.

Getting error while launching

Hello,
I downloaded the zip and included libraries as suggested on help document: http://developer.couchbase.com/mobile/develop/training/build-first-android-app/get-started-eclipse/index.html

But I am getting following errors:

[2014-11-30 18:30:10 - MainActivity] The library 'couchbase-lite-android-source-1.0.3.1.jar' contains native libraries that will not run on the device.
[2014-11-30 18:30:10 - MainActivity] The following libraries were found:
[2014-11-30 18:30:10 - MainActivity]  - libraries/couchbase-lite-android/jniLibs/mips/libcom_couchbase_touchdb_TDCollateJSON.so
[2014-11-30 18:30:10 - MainActivity]  - libraries/couchbase-lite-android/jniLibs/mips/libcom_couchbase_touchdb_RevCollator.so
[2014-11-30 18:30:10 - MainActivity]  - libraries/couchbase-lite-android/jniLibs/armeabi-v7a/libcom_couchbase_touchdb_TDCollateJSON.so
[2014-11-30 18:30:10 - MainActivity]  - libraries/couchbase-lite-android/jniLibs/armeabi-v7a/libcom_couchbase_touchdb_RevCollator.so
[2014-11-30 18:30:10 - MainActivity]  - libraries/couchbase-lite-android/jniLibs/x86/libcom_couchbase_touchdb_TDCollateJSON.so
[2014-11-30 18:30:10 - MainActivity]  - libraries/couchbase-lite-android/jniLibs/x86/libcom_couchbase_touchdb_RevCollator.so
[2014-11-30 18:30:10 - MainActivity]  - libraries/couchbase-lite-android/jniLibs/armeabi/libcom_couchbase_touchdb_TDCollateJSON.so
[2014-11-30 18:30:10 - MainActivity]  - libraries/couchbase-lite-android/jniLibs/armeabi/libcom_couchbase_touchdb_RevCollator.so

App crashes if more than one Picture is taken

I wanted to make use of the attachment feature in my app to take multiple pictures and attach them to a document. I used the same implementation as done in 333ae1d and for the first picture this works fine but taking a second picture will crash the app. To test if this issue was not on my end I tried doing the same with TodoLite and it showed the same behavior but with different exceptions.

I'd greatly appreciate a working example which can attach multiple files to one doc.

To reproduce this: take 2 pictures for the same task.

exception in my app:

java.lang.NullPointerException
at com.couchbase.lite.Database.generateIDForRevision(Database.java:3179)
at com.couchbase.lite.Database.putRevision(Database.java:3587)
at com.couchbase.lite.Database.putRevision(Database.java:3421)
at com.couchbase.lite.Document.putProperties(Document.java:407)
at com.couchbase.lite.UnsavedRevision.save(UnsavedRevision.java:102)
at com.wgottschalg.wgcloud.fragments.StepFragment.attachImageToDoc(StepFragment.java:186)
at com.wgottschalg.wgcloud.fragments.StepFragment.onActivityResult(StepFragment.java:166)
at android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:167)
at android.app.Activity.dispatchActivityResult(Activity.java:5423)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3347)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3394)
at android.app.ActivityThread.access$1300(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)

exception in todo lite:

 com.couchbase.todolite I/dalvikvm﹕ java.lang.OutOfMemoryError:
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:620)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:376)
at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:402)
at com.couchbase.todolite.MainActivity$TasksFragment.onActivityResult(MainActivity.java:597)
at android.app.Activity.dispatchActivityResult(Activity.java:5427)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3347)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3394)
at android.app.ActivityThread.access$1300(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
"main" prio=5 tid=1 NATIVE
| group="main" sCount=0 dsCount=0 obj=0x418eaca8 self=0x41509480
| sysTid=1491 nice=0 sched=0/0 cgrp=apps handle=1074393428
| state=R schedstat=( 1862582770 1497209078 7331 ) utm=157 stm=29 core=0
#00  pc 0000132e  /system/lib/libcorkscrew.so (unwind_backtrace_thread+29)
#01  pc 0006057a  /system/lib/libdvm.so (dvmDumpNativeStack(DebugOutputTarget const*, int)+33)
#02  pc 00054570  /system/lib/libdvm.so (dvmDumpThreadEx(DebugOutputTarget const*, Thread*, bool)+395)
#03  pc 000545de  /system/lib/libdvm.so (dvmDumpThread(Thread*, bool)+25)
#04  pc 00038728  /system/lib/libdvm.so
#05  pc 00040050  /system/lib/libdvm.so
#06  pc 00077788  /system/lib/libandroid_runtime.so
#07  pc 00078530  /system/lib/libandroid_runtime.so (GraphicsJNI::allocateJavaPixelRef(_JNIEnv*, SkBitmap*, SkColorTable*)+103)
#08  pc 000785ca  /system/lib/libandroid_runtime.so (JavaPixelAllocator::allocPixelRef(SkBitmap*, SkColorTable*)+17)
#09  pc 0009bfd2  /system/lib/libskia.so (SkBitmap::allocPixels(SkBitmap::Allocator*, SkColorTable*)+25)
#10  pc 000ff0e8  /system/lib/libskia.so (SkJPEGImageDecoder::onDecode(SkStream*, SkBitmap*, SkImageDecoder::Mode)+327)
#11  pc 000fc5b2  /system/lib/libskia.so (SkImageDecoder::decode(SkStream*, SkBitmap*, SkBitmap::Config, SkImageDecoder::Mode)+33)
#12  pc 00075778  /system/lib/libandroid_runtime.so
#13  pc 00075924  /system/lib/libandroid_runtime.so
#14  pc 0001dbcc  /system/lib/libdvm.so (dvmPlatformInvoke+112)
#15  pc 0004e042  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+397)
#16  pc 00026fe0  /system/lib/libdvm.so
#17  pc 0002df9c  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#18  pc 0002b640  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#19  pc 0006078c  /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+391)
#20  pc 000686fa  /system/lib/libdvm.so
#21  pc 00026fe0  /system/lib/libdvm.so
#22  pc 0002df9c  /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#23  pc 0002b640  /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#24  pc 000604aa  /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+337)
#25  pc 00049c2a  /system/lib/libdvm.so
#26  pc 0004d2e8  /system/lib/libandroid_runtime.so
#27  pc 0004e00e  /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+353)
#28  pc 0000105a  /system/bin/app_process
#29  pc 0000e410  /system/lib/libc.so (__libc_init+47)
at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:620)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:376)
at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:402)
at com.couchbase.todolite.MainActivity$TasksFragment.onActivityResult(MainActivity.java:597)
at android.app.Activity.dispatchActivityResult(Activity.java:5427)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3347)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3394)
at android.app.ActivityThread.access$1300(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)

sync owner error

1.create some docs,and this time i query the doc:
sqlite> select *from revs;
1|1|1-7ff8f7ca3dc92d7778a29e8322df1e64||1|0|{"created_at":"2014-11-20T08:33:49.263Z","title":"test_n_u","type":"list"}|1
2|2|1-b581b54b4248733f630e1c06d92ec9bc||1|0|{"created_at":"2014-11-20T08:33:59.049Z","list_id":"FC67EC50-6D3E-4820-867E-E525268EFB3C","title":"t_task","type":"task"}|1
3|3|1-487195fc60c1a8fe4e036192a6a4e990||1|0|{"created_at":"2014-11-20T08:35:26.545Z","title":"test","type":"list"}|1

2.login and sync. query:
sqlite> select *from revs;
1|1|1-7ff8f7ca3dc92d7778a29e8322df1e64||0|0|{"created_at":"2014-11-20T08:33:49.263Z","title":"test_n_u","type":"list"}|1
2|2|1-b581b54b4248733f630e1c06d92ec9bc||1|0|{"created_at":"2014-11-20T08:33:59.049Z","list_id":"FC67EC50-6D3E-4820-867E-E525268EFB3C","title":"t_task","type":"task"}|1
3|3|1-487195fc60c1a8fe4e036192a6a4e990||0|0|{"created_at":"2014-11-20T08:35:26.545Z","title":"test","type":"list"}|1
4|3|2-63dca005ec875545c3fbc017bce88f7f|3|1|0|{"created_at":"2014-11-20T08:35:26.545Z","owner":"p:1915a5f2-fd61-464b-b79b-97c09647c89f","title":"test","type":"list"}|1
5|1|2-1032c0b585f1abd5dcbf5ac984f92f22|1|1|0|{"created_at":"2014-11-20T08:33:49.263Z","owner":"p:1915a5f2-fd61-464b-b79b-97c09647c89f","title":"test_n_u","type":"list"}|1
6|4|1-f123266e02ce66c486df2d848e4538de||1|0|{"name":"1915a5f2-fd61-464b-b79b-97c09647c89f","type":"profile","user_id":"1915a5f2-fd61-464b-b79b-97c09647c89f"}|1
7|5|1-3c4171f1169d9c01fd4954aa47c050e1||0|0||1

so the question is:if i do not login first ,it will copy double docs in my database. and then when i query db,the result will return wrong .
how to fix it ?
Thanks.

Creating a list on iOS and sharing only syncs with Android sometimes

My setup is a follows. iOS device on Wifi. sync_gateway running on localhost. Android emulator running on the same machine as sync_gateway. Both iOS and Android are able to push changes to sync_gateway but lists created on iOS do not allow get pulled to Android when explicitly shared from iOS.

Make GCM sync work after app is killed

When the app is running in the background GCM sync works. But when the app is killed or have not been started yet GCM sync is not working because full DB initialization did not happen (sync gateway logs 401 Login required). Is it possible to initialize DB in the Application class instead of the MainActivity so when GcmMessageHandler tries to pull changes it has already initialized DB?
This would ensure that the app synchronizes data every time.

How to build this project?

I used the default gradlew to build.
However, there is an error msg that I can't get pass.

  • Exception is:
    org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':ToDoLite'.
    at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:79)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:74)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:61)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:507)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:82)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.Main.doAction(Main.java:46)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at org.gradle.launcher.Main.main(Main.java:37)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
    Caused by: org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'default' not found.
    at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.createNotFoundException(DefaultConfigurationContainer.java:91)
    at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:192)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:81)
    at org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency.getProjectConfiguration(DefaultProjectDependency.java:69)
    at org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency_Decorated.getProjectConfiguration(Unknown Source)
    at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.getProperty(BeanDynamicObject.java:153)
    at org.gradle.api.internal.BeanDynamicObject.getProperty(BeanDynamicObject.java:107)
    at org.gradle.api.internal.CompositeDynamicObject.getProperty(CompositeDynamicObject.java:78)
    at org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency_Decorated.getProperty(Unknown Source)
    at com.android.build.gradle.BasePlugin$_ensureConfigured_closure132.doCall(BasePlugin.groovy:2169)
    at com.android.build.gradle.BasePlugin.ensureConfigured(BasePlugin.groovy:2167)
    at com.android.build.gradle.BasePlugin.resolveDependencyForConfig(BasePlugin.groovy:2085)
    at com.android.build.gradle.BasePlugin.this$2$resolveDependencyForConfig(BasePlugin.groovy)
    at com.android.build.gradle.BasePlugin$this$2$resolveDependencyForConfig.callCurrent(Unknown Source)
    at com.android.build.gradle.BasePlugin.resolveDependencies(BasePlugin.groovy:2042)
    at com.android.build.gradle.internal.VariantManager.createTasksForDefaultBuild(VariantManager.java:304)
    at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:167)
    at com.android.build.gradle.internal.VariantManager$createAndroidTasks.call(Unknown Source)
    at com.android.build.gradle.AppPlugin.doCreateAndroidTasks(AppPlugin.groovy:60)
    at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.groovy:370)
    at com.android.build.gradle.BasePlugin$_apply_closure7.doCall(BasePlugin.groovy:308)
    at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:40)
    at org.gradle.listener.ClosureBackedMethodInvocationDispatch.dispatch(ClosureBackedMethodInvocationDispatch.java:25)
    at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:79)
    at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:31)
    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy15.afterEvaluate(Unknown Source)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:67)
    ... 29 more

Crash reports with email notifications

I think this is important since it might help catch hard-to-reproduce couchbase lite bugs.

Crashlytics seems like the best choice. @pasin any thoughts on which crash reporting framework you'd recommend?

Does not indicate when logged out

After not using the app for a while, the FB user will be logged out and the replication will stop working.

When the FB user is logged out, it should at least indicate this in the UI somewhere.

Crashing when uploading lots of images

To reproduce:

  • Choose a list
  • Upload several tasks with images using a Nexus 4 device -- I was taking photos of documents.

I was getting frequent crashes.

Allow guest login

One nice thing about GrocerySync is that it allows guest login, which is useful for testing without having to deal with facebook or mozilla auth.

Couchbase View uses external data

function
getQuery(Database database, final String ignoreUserId)
uses fileld ignoreUserId inside View's mapper function. According to official docs it is incorrect :
"It must be a "pure" function: That means any time it's called with the same input, it must produce exactly the same output. In other words, it can't use any external state, just its input JSON."

Code needs to use facebook user id instead of email in profile doc id

Due to couchbase/sync_gateway#580

Getting this error on todolite ios:

12:13:12.206‖ WARNING: CBL_Pusher[http://localhost:4984/todos]: _bulk_docs got an error: {
    error = forbidden;
    id = "p:[email protected]";
    reason = "wrong user";
    status = 403;
}

The problem is that requireUser() expects the facebook ID, since after the PR, the user doc in couchbase server is:

doc id : _sync:user:1378769115762233
{
  "name": "1378769115762233",
  "all_channels": {
    "!": 1
  },
  "sequence": 0,
  "email": "[email protected]",
  "passwordhash_bcrypt": "JDJhJDEwJC9wTDNFY1ZPclVLZUt2NERjOHVQZU9ZL3h4V3kxUHhEU1JqeGFpSGFWeDFuTFFrLmF1Sk5t",
  "rolesSince": {}
}

Need to change:

  • profile doc id
  • user id

to be the facebook user id rather than the email.

Also, to make debugging easier, we should add a new field to the profile document to hold the email address, since after the above changes the profile doc will no longer have email anywhere else.

Item not pushed from Android -> iOS

To reproduce:

  • Add 4 items from TodoLite ios (from app store)
  • On TodoLite Android (master branch), add a photo to one of the items (in this case, The Melt)
  • On TodoLite Android, add a new item (in this case, Super Duper) without a photo

Observations:

  • The photo of The Melt did not appear on TodoLite ios
  • The Super Duper item did not appear on TodoLite ios

ios screenshot
android screenshot

After doing the above steps, I added a new item on the iOS device "Ayola Gyros", which successfully sync'd to the Android Device.

ToDoLite: doesn't build using official instructions

Currently the documentation for building ToDoLite refers to the following compatibility list for Android Studio: https://github.com/couchbase/couchbase-lite-android#building-couchbase-lite-master-branch-from-source

I have been following the instructions for downloading and building ToDoLite Android here:
http://developer.couchbase.com/mobile/get-started/get-started-mobile/android/building-todo-lite/index.html

I see two problems here:

  1. If you follow the instructions, you will end up downloading Android Studio 0.8.9, which is not compatible with the latest Couchbase Lite / ToDo Lite, and leads to gradle errors:
    "Failed to set up Android modules in project 'ToDoLite-Android': Unsupported method: BaseArtifact.getJavaCompileTaskName()."
  2. If you follow the instructions in documentation, then the tutorial will lead to you getting the latest master branch of Couchbase Lite. The tutorial should be using the latest Couchbase Lite to have completed a full QA and release cycle. (People trying out the tutorial for first time shouldnt run into any potential issues with whatever happens to have been comitted to master)

Facebook userId Null -> Crash

Hello,

after fixing the 'issue' with appId/hash, the app crashes in this line:

          profile = Profile.getUserProfileById(getDatabase(), userId);

I noticed that userId is null, but I don't know what to use else!?
THX

Build error

I'm getting these build errors:

Executing tasks: [:ToDoLite:assembleDebug]

Configuration on demand is an incubating feature.
build 'ToDoLite-Android'[couchbase-lite-java-forestdb] No build 'spec' defined, use 'android' by default
[couchbase-lite-java-sqlcipher] No build 'spec' defined, use 'android' by default
[couchbase-lite-java-sqlcipher] No build 'spec' defined, use 'android' by default
[sqlcipher] No build 'spec' defined, use 'android' by default
:ToDoLite:preBuild UP-TO-DATE
:ToDoLite:preDebugBuild UP-TO-DATE
:ToDoLite:checkDebugManifest
:ToDoLite:preDevBuild UP-TO-DATE
:ToDoLite:preReleaseBuild UP-TO-DATE
:libraries:couchbase-lite-android:compileLint
:libraries:couchbase-lite-android:copyReleaseLint UP-TO-DATE
:libraries:couchbase-lite-android:mergeReleaseProguardFiles
:libraries:couchbase-lite-android:preBuild UP-TO-DATE
:libraries:couchbase-lite-android:preReleaseBuild UP-TO-DATE
:libraries:couchbase-lite-android:checkReleaseManifest
:libraries:couchbase-lite-android:preDebugAndroidTestBuild UP-TO-DATE
:libraries:couchbase-lite-android:preDebugBuild UP-TO-DATE
:libraries:couchbase-lite-android:preDebugUnitTestBuild UP-TO-DATE
:libraries:couchbase-lite-android:preReleaseUnitTestBuild UP-TO-DATE
:libraries:couchbase-lite-java-core:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.6
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning

:libraries:couchbase-lite-java-core:processResources UP-TO-DATE
:libraries:couchbase-lite-java-core:classes
:libraries:couchbase-lite-java-core:jar
:libraries:couchbase-lite-java-forestdb:compileLint
:libraries:couchbase-lite-java-forestdb:copyReleaseLint UP-TO-DATE
:libraries:couchbase-lite-java-forestdb:mergeReleaseProguardFiles
:libraries:couchbase-lite-java-forestdb:generateForestDBStoreJniHeaders
:libraries:couchbase-lite-java-forestdb:generateCBForestJniHeaders
Error: Could not find class file for 'com.couchbase.cbforest.Database'.
Error: Could not find class file for 'com.couchbase.cbforest.Document'.
Error: Could not find class file for 'com.couchbase.cbforest.DocumentIterator'.
Error: Could not find class file for 'com.couchbase.cbforest.ForestException'.
Error: Could not find class file for 'com.couchbase.cbforest.Logger'.
Error: Could not find class file for 'com.couchbase.cbforest.QueryIterator'.
Error: Could not find class file for 'com.couchbase.cbforest.View'.

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':libraries:couchbase-lite-java-forestdb:generateCBForestJniHeaders'.
> Process 'command 'javah'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 7.354 secs

Todolite-Android commit: 7bd4d32
Android Studio: 1.5.1

I did check out the submodules .. not sure what else I should check?

Not pulling items correctly

To reproduce:

  1. Change SYNC_URL to http://10.0.3.2:4984/todolite/, running sync gateway commit e7c0b389b6
  2. Clear out sync gateway db
  3. Uninstall / Reinstall app
  4. FB login
  5. Add some items, they will be pushed to sync gateway
  6. Uninstall / Reinstall app
  7. FB login

Expected the items should be pulled

Actual nothing is pulled

Also note: after step 5 above, try running and it will return an empty list.

$ httpie localhost:4984/todolite/_all_docs Cookie:SyncGatewaySession=1ad4370a98b9f5c5326ddba43090c0d276df19b4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.