Hi,
I started my solution from scratch, New Xamarin.Forms (c#) solution, Shared Library, With 3 target devices, UWP, Android and Ios, and I activated the Android project.
I let the blank solution created by VS2017 with the shared project, and didn’t add a .Net standard Library. That’s in the shared project that I’m trying to connect with my couchbase Database and to start the replication.
Important info : If I activate the UWP project, the app work fine. My code seems to be good.
I started ma app thru Xamarin Live player (for debugging), The app start, but I’he this exceptions:
Index was outside the bounds of the array. (IndexOutOfRangeException)
Could not find type `LiteCore.Interop.C4Document*` in `Couchbase.Lite`
Cannot load interpreted field `<ThreadSafety>k__BackingField` on <null> ()
Specified cast is not valid. (InvalidCastException)
Cannot load interpreted field `<Status>k__BackingField` on <null> ()
I called the Active function as defined in the spec.
I tested to generate the Apk (in case that the trouble come with Xamarin Live player) and install my app on my tablette and my phone. No way, the App crashs on each devices.
I really need to make It work, I have less than 2 weeks.
Please help, I don’t know what to do to make it worked !
Regards
Steeve
You need to provide more information, or ideally a project that reproduces the issue for us to do anything about this. The first looks like you are trying to access in invalid location inside of an array. The others look like possible you have several versions of Couchbase Lite installed on different projects (make sure all your projects are referencing the same version).
Hy Jim,
I put my solution on Gihub, at this adresse :
https://github.com/SteeveQuadra/XamCouch.git
I’m working with the travel-sample database, it will be easy for you to connect a replication.
The code is in the class CouchbaseHelper, in the shared project.
It’s a POC, you have a button Update to show the updated status of the replication, and a button Read Datas to list all the docs with the type “airline”.
I did commit my sync gateway config json file.
I’m using a couchbase server 5.0 local on my computer, and sync gateway 1.5, local on my computer too.
Of course, I din’t commit all the nuget packages, you will have to restore them.
Hope you can find what’s happening.
Regards
Steeve
I will take a look at it tomorrow, but what should I do to trigger the issue?
P.S. I don’t know if this will make a difference, but in the travel sample app I use this line
Couchbase.Lite.Support.Droid.Activate(ApplicationContext);
instead of what you are using
Couchbase.Lite.Support.Droid.Activate(this);
ApplicationContext
is a property on the class that is provided by Xamarin and lasts for the lifetime of the application so it would probably be more reliable to use.
HI,
Chose Android as starting project, connect an android device thru Xamarin live player, and start the application.
The GUI will apprear, and you will have an uncaught exception in your xamarin Live player log (don’t forget to activate the logs).
If you want, you can firstly chose the UWP project and test it under Windows 10, this version is working.
If I can help in anyway …
Thank you.
Regards,
Steeve
PS : I always made shure that my sync gateway port was open, and reachable from my android devices before trying my app.
I wil try with Couchbase.Lite.Support.Droid.Activate(ApplicationContext); and give you a feedback.
It changed nothing, sadly.
Steeve
connect an android device thru Xamarin live player
I’m not very interested in doing that. I have never used the Xamarin Live Player, but you mentioned that the issue still happens on device right? It does not happen for me on my Nexus 5 running API 25. I see no exceptions.
Hi Jim,
First of all, thank you to have spent some time to test my solution, that is so great !
The result of your test is as surprising as non helping, I have to tell that I would have prefered that you find something concrete that you or I could correct.
Did you linked my app with sync gateway ? Did you clicked on the button “Read datas” and obtained the list of airlines ?
How do you debug without Xamarin live player ? (Parhaps in using your android device with a cable ? If yes, shame on me to not have thought about this possibility by myself !)
I did test on API 24 and 25, and I had the same result.
About the fact you’re not interested to try and use Xamarin live player, I’m very surprise. Don’t take it personnaly, it’s not my goal, and I’m very glad to have you to help, but Xamarin live player is the new way recommanded by microsoft and the Xamarin team. The xamarin forms developpers, like mysefl, will certainly and naturally use it the way it’s recommanded. So this question came in my head : How can couchbase be Xamarin certified if the couchbase developpers don’t test it this way too ?
Comming back to the subject of this post, can you confirm what did you tested exactly, and how ?
Thank you again.
Regards
Steeve
Hi again Jim,
I tested connecting my android phone, API 24, with a cable, and you know what, It’s working !!
The database connection with couchbase 2.0 (db19), the replication with sync gateway 1.5.
There is this 2 problems :
- It’s not working thru Xamarin live player
- How to make it worked in a release apk ?
I will continue to look at that, if you or someone else have any idea to help …
Regards,
Steeve
If it works on a device that is what matters to me. If it works on a device and in an emulator but not in the live player then that seems like a problem with the live player to me. Actually I’ve never even heard of it until you brought it up so it must be pretty new. I imagine it might suffer some problems that are similar to APK fast deployment. Does the live player need some special attention by developers?
I tested your solution by using a cable connected to my device. What is the problem with release mode?
Hey Jim,
For what I know about Xamarin Live player, the developer doesn’t need some special attention. But again, I may be wrong, xamarin is as new for me than couchbase. Xamarin Live player used to doesn’t accept .Net standart library until the last version on android, which corrected this problem that we discussed in an another post.
And yes, Xamarin Live player is a very new tech on this philosophy. It’s one of my goal, to start with a recent tech and make it work. Tech is now too speedly obsolete. Clients don’t want to pay the same apps every 2 or 3 years.
About the release Apk, I tested a blank solution with sucesses, so I released my app following the same protocol, which give me the result : crach every time. It’s probably some options I’m missing. I will meet someone to help me with xamarin in 2 weeks, I will ask him how to make my app work in release mode. I’ll give you a feedback.
At least I’m able to test my app with android, step by step, and with your help, my proof of concept is about to work !
Thank you again.
Regards
Steeve
The live player certainly sounds interesting if it works. I remember this feature from before as an interactive XAML editor but it seems like Xamarin has taken it one step further now with an app that accepts live updates of full functionality instead of just UI mockups. I’ll see about using it for developing our travel sample app from now on.
Hi,
It seems that It’s not totally operational for now, sadly. Each time I’m testing something new in my solution, today’s was the dependency injection, It work on UWP, on xamarin thru cable, and I can’t make it work thru Xamarin live player. There are always some exceptions. It’s probably too early for now.
I’m happy you made me think about the cable solution, now I know that the problem is Xamarin Live player.
Regards
Steeve