Reputation:
I am new in Android Application, In my android application with C# base, i want to use MySqlConnection. But when i add reference of MySql.Data.dll it gives me exception in VS 2010 and unable run my application.
Exception
Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile? File name: 'System.Configuration.Install.dll' at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List
1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(List
1 assemblies, AssemblyDefinition assembly, Boolean topLevel) at Xamarin.Android.Tasks.ResolveAssemblies.Execute()
Can anyone tell me what i am doing wrong? Thanks in advance
Upvotes: 2
Views: 3642
Reputation: 12253
I know this is a bit old question but I think that my answer would help people with the same problem.
So, I think exception occurs when you want to directly connect your android app with the database using MySql.Data.dll. Everyone who knows the security risks in this approach but still wants to do it in this way, should use MySql.Data.CF.dll instead of MySql.Data.dll. This will remove the exception (at least it was in my case).
However, I suggest using Web Service to enable interaction with database.
Hope my answer is helpful.
Upvotes: 0
Reputation: 656
If your looking for a device local solution you may want to try implementing a SQLLite solution vs trying to rig up a MySQL solution. SQLLite is well supported and natively supported by the os. Check out this link to get the item straight from Xamarin. http://components.xamarin.com/view/sqlite-net/ I've had a lot of luck using it.
Alternatively if your looking for an external MySQL connection then there is this link here. http://www.mono-project.com/MySQL
Good luck!
Upvotes: 0
Reputation: 26495
You can't really use compiled desktop .Net libraries with Xamarin projects unless it is a PCL (Portable Class Library).
Your best bet is to download the source for MySQL.Data here.
Then make an Android Library project, and link-in all the C# files. It should be fairly straightforward, but you might run into a compiler error or two. Most of the work will be removing things that don't exist in Xamarin's subset of .Net.
Upvotes: 0