ultrara1n/MiToolkit

no such table: devicerecord

Opened this issue · 3 comments

Hello,

I am facing the issue:

  • Click Extract Token
  • Dialog says Don't set a password for backup - click OK.
  • Backup page pops up on the phone - click BACKUP MY DATA
  • Phone says Backup finished
  • App says Backup successful, starting extract click OK
  • Error dialog says: no such table: devicerecord
    image
See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Data.SQLite.SQLiteException (0x80004005): SQL logic error or missing database
no such table: devicerecord
   at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
   at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
   at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
   at System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader()
   at MiToolkit.frmToken.cmdGetToken_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2563.0 built by: NET471REL1
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
MiToolkit
    Assembly Version: 1.6.0.0
    Win32 Version: 1.6.0.0
    CodeBase: file:///C:/Users/denis/cr3/Downloads/MiToolkit%201.6/MiToolkit.exe
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 10.0.0.0
    Win32 Version: 14.7.2558.0 built by: NET471REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2558.0 built by: NET471REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2563.0 built by: NET471REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2558.0 built by: NET471REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2558.0 built by: NET471REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2558.0 built by: NET471REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2612.0 built by: NET471REL1LAST_B
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2558.0 built by: NET471REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
MiToolkit.resources
    Assembly Version: 1.6.0.0
    Win32 Version: 1.6.0.0
    CodeBase: file:///C:/Users/denis/cr3/Downloads/MiToolkit%201.6/en/MiToolkit.resources.DLL
----------------------------------------
System.Data.SQLite
    Assembly Version: 1.0.105.2
    Win32 Version: 1.0.105.2
    CodeBase: file:///C:/Users/denis/cr3/Downloads/MiToolkit%201.6/System.Data.SQLite.DLL
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2623.0 built by: NET471REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2558.0 built by: NET471REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 4.0.0.0
    Win32 Version: 4.7.2558.0 built by: NET471REL1
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

My config:

  • Mi Home app version: 5.0.19
  • Blackview BV6000, Android 7.0, Kernel 3.18.35

Hello,

same issue here, looks like the backup file is corrupted.

I did use a manuel workaround with the help of the MiToolkit source code (android sdk must be correctly installed and configured for the first command below, or you might use the one embedded in MiToolkit?):

  1. backup app data manually using adb
    adb backup -f xiaomi.ab com.xiaomi.smarthome
  2. extract data using android backup extractor
    java -jar abe.jar unpack xiaomi.ab xiaomi.tar
  3. extract tar and open miio2.db sqlite database file located under apps\com.xiaomi.smarthome\db using any sqlite client
  4. get the data with the query
    SELECT name, token, model FROM devicerecord

Regards.

I had the same issue,
I discovered that then Java client was not installed correctly on my PC. (couldn't run "java" from commandline)

It seems MiToolkit starts w/out problems even if Java is not installed correctly - but then it fails extracting the backup file.

After reinstalling Java (and doublechecking that commandline-java is available) it did work for me.

(this might not be solution for everyone, but maybe someone can validate my findings)

I faced same issue and installing Java solve that !
Make a java intallation check while starting the MiToolkit program?