0

I have clicked on Tools -> Android -> Android Device Monitor in VS 2015 and got the following error, but my xamarin android player works fine.

enter image description here

Is there a way to access to local database (sqlite) in the xamarin android player simulator not on the physical device?

Update:

I am using adb and getting the following error

enter image description here

casillas
  • 16,351
  • 19
  • 115
  • 215
  • The error msg is pretty clear, isn't it? – Haytem BrB May 03 '16 at 17:34
  • It is, java is 32 bit installed for xamarin android player. If I removed that folder then it will direct to 64 bit installation, but then xamarin player wont work. – casillas May 03 '16 at 17:36
  • What type of access do you need to the file? Do you need to copy it from the emulator? To the emulator? Or? – SushiHangover May 03 '16 at 17:36
  • I just need to access and open my sqlite file with db visualizer tool – casillas May 03 '16 at 17:37
  • Possible duplicate of [How to view the sqlite database in device android](http://stackoverflow.com/questions/19194576/how-to-view-the-sqlite-database-in-device-android) – SushiHangover May 03 '16 at 17:38
  • I added a dup link, using Android's `adb` is the way to copy files to/from your device/emulator to your local pc filesystem – SushiHangover May 03 '16 at 17:39
  • I am not using Android Studio, I am using Visual Studio – casillas May 03 '16 at 17:40
  • FYI: `adb` is **the** console interface to your device, it is used by all toolsets, include Visual Studio/Xamarin for deploying apks, frameworks, installing, uninstalling, logcat output... – SushiHangover May 03 '16 at 17:42
  • I am trying to access on the simulator, not in the device at the moment. I have run the command on adb and got the following error : `no devices found` – casillas May 03 '16 at 17:45
  • Is your emulator currently running? If so try doing a `adb devices` to get the current list of devices that are running/connected/available (this is same method Xamarin uses to see which devices it can deploy to). – SushiHangover May 03 '16 at 17:50
  • If I only type `adb devices`, I could able to see a single device attched. But when I type the command `adb -d shell "run-as com.SM.Android ls /data/data/com.SM.Android/databases/"` I am getting no devices found – casillas May 03 '16 at 17:57

2 Answers2

1

Failed to load the JNI shared library "C:/XXXXX/jvm.dll"`.

This is a sign of a mixed 32/64 Java bit Java install and/or the wrong version is installed.

Xamarin on Windows requires a Windows x86 version of v1.7

It is essential to install the 32-bit version of the Java JDK even if you're using 64-bit Windows. It is also important that v1.7 of the Java JDK is installed (although it is fine to have 1.8 or newer installed at the same time).

So I would start by installing Java v1.7, since the error is pointing to v1.6 and retrying to open the Android Device Monitor.

Installing the Java SDK (JDK)

The JDK can be downloaded from any browser by visiting Oracle’s website and browsing to the section with the heading Java SE Development Kit 7u79

Ref: https://developer.xamarin.com/guides/android/getting_started/installation/windows/manual_installation/#Installing_the_Java_SDK_JDK

Community
  • 1
  • 1
SushiHangover
  • 73,120
  • 10
  • 106
  • 165
  • If I only type `adb devices`, I could able to see a single device attached. But when I type the command `adb -d shell "run-as com.SM.Android ls /data/data/com.SM.Android/databases/"` I am getting `no devices found` – casillas May 03 '16 at 18:00
  • @hotspring Try `adb connect {device:port}` first.. It should auto connect if only one device is available, otherwise you have to specify the device host:port for the command to be executed against. – SushiHangover May 03 '16 at 18:07
  • I have tried and got the following error: `unable to connect to {10.71.34.101:55555 }cannot resolve host and port, no such host is known` – casillas May 03 '16 at 18:14
  • @hotspring Is it "55555" or "5555"? Normal they start at 5555 (4 digits) – SushiHangover May 03 '16 at 18:17
  • sorry I have mistyped, only four digits. I have tried and got the following error: `unable to connect to {10.71.34.101:5555 }cannot resolve host and port, no such host is known` – casillas May 03 '16 at 18:22
  • @hostspring Are you including the braces? that is a substitution indictor, do not include those... see http://developer.android.com/tools/help/adb.html for details – SushiHangover May 03 '16 at 18:34
  • Please see my updated question included a screen shot. – casillas May 03 '16 at 18:36
  • ok, I have removed the braces and it says it is already connected, it is good indication :-) Now how could I able to access to sqlite file? I have checked my manifest is to make sure, my application is called `schedulingmonitor` I have tried the following `adb -d shell "run-as com.schedulingmonitor ls /data/data/com.schedulingmonitor/databases/"` but it gives me no devices found error – casillas May 03 '16 at 18:43
  • I have posted the answer. Thanks for your effort. – casillas May 03 '16 at 19:27
0

Solution 1:

I run tools->android-> android adb command prompt in visual studio

I have followed the followings to access the database

step1. >adb shell

step2. >cd data/data

step3. >ls -l|grep "com.xxxx"

step4. >cd "com.xxxx"

Then I used the following to copy sql file to my workstation

adb shell "run-as com.xxxx chmod 666 /data/data/com.xxxx/files"
adb pull /data/data/com.xxxx/files/xx.sql
adb shell "run-as com.xxxx chmod 600 /data/data/com.xxxx/files"

Then I have downloaded sqlite browser to open the file and see the tables.

Solution 2:

Alternatively, you can go to following directory and double click the exe file

C:\Users\XXXXX\AppData\Local\Android\ANDROI~1\tools\lib\monitor-x86_64\monitor.exe
casillas
  • 16,351
  • 19
  • 115
  • 215