Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WP8 SQLite error: The specified module could not be found

I'm trying access a SQLite database from my Windows Phone 8 app but am encountering the following error whenever SQLite code is hit:

{System.IO.FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at System.StubHelpers.StubHelpers.GetWinRTFactoryObject(IntPtr pCPCMD)
   at Sqlite.Sqlite3.sqlite3_open_v2(String filename, Database& db, Int32 flags, String zVfs)
   at SQLite.SQLite3.Open(String filename, Database& db, Int32 flags, IntPtr zVfs)
   at SQLite.SQLiteConnection..ctor(String databasePath, SQLiteOpenFlags openFlags, Boolean storeDateTimeAsTicks)
   at TopoMap.Map.MapTileServer.<Initialise>d__0.MoveNext()}
  • I've installed the Visual Studio extension SQLite for Windows Phone (v3.8.4.3).
  • I've installed the sqlite-net-wp8 NuGet package (v3.8.4.3).
  • I've added SQLite.cs and SQLiteAsync.cs to my project.
  • I've added the USE_WP8_NATIVE_SQLITE conditional compilation symbol to my project.

The project runs fine with no issues until a line of code is hit that accesses the underlying Sqlite3 class.

Any ideas what the issue might be?

like image 419
Gavin Avatar asked Apr 21 '14 09:04

Gavin


Video Answer


1 Answers

  1. Delete all references to sqlite from solution
  2. Install Sqlite for WP8 from http://visualstudiogallery.msdn.microsoft.com/cd120b42-30f4-446e-8287-45387a4f40b7
  3. Restart Visual Studio. In my case it's Visual Studio 2013.
  4. open your solution where you want to use sqlite
  5. Using package manager console in order to install sqlite-net. Enter the following command: Install-package sqlite-net
  6. Install sqlite-net-wp8. Enter the following command: Install-package sqlite-net-wp8
  7. Add compilation cofiguration

    7.1 Right-click the project and select Properties.

    7.2 Select the Build tab.

    7.3 In the Configuration list, select All Configurations.

    7.4 In the Platform list, select All Platforms.

    7.5 On the Build tab, you’ll see Conditional compilation symbols under the General header, containing a default value of SILVERLIGHT;WINDOWS_PHONE on a Windows Phone app project. Change the value to SILVERLIGHT;WINDOWS_PHONE;USE_WP8_NATIVE_SQLITE and save the project file.

  8. Right-click References and select add reference.Go to Windows Phone -> Extensions and check the option SQlite for Windows Phone

It works for me!! Good luck

like image 134
llanox Avatar answered Oct 17 '22 12:10

llanox