Unity3d UnauthorizedAccessException error


#1

Hello, I have integrating Couchbase Lite into my unity3d project and was having no problems until I started testing on an Android device. As soon as the “Manager” class is being created I get this error on LogCat:

D/Unity   (21974): Manager
D/Unity   (21974): :
D/Unity   (21974): Starting Manager version: 1.0.5_unofficial
D/Unity   (21974):
I/Unity   (21974): UnauthorizedAccessException: Access to the path "/.local" is
denied.

Like I said before, Everything else works in the unity3d editor. I can create the Manager and add documents and then retrieve them but on the Android build the Manager errors out of creation and then produces null reference errors.

I have already done a little research and was suggested to change my project settings to “write external” and this has not fixed the issue. Any ideas?

Thanks for your time!


#2

In Unity3D you cannot use the Manager SharedInstance without setting it to something else first. You need to create a Manager object that uses the Application.persistentDataPath as in the following line:

new Manager (new DirectoryInfo (Application.persistentDataPath), ManagerOptions.Default);

I will make sure this info gets added to the wiki.


#3

Thanks borrrden I am pretty sure this is exactly what I need.

Can I ask you one other question? When I import the unity plugins folder containing the .dll files I get a compile error:

Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 

  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 

I had bypassed this error by changing my unity .net settings to 2.0 instead of the subset and then re-importing my assets. But today the error is not going away.

any ideas?


#4

This is for Android right? Check the editor logs to see which class is having trouble.