oNaiPs / droidVncServer

VNC server for Android devices.
GNU General Public License v3.0
909 stars 480 forks source link

Does not work with Genymotion #71

Open radj opened 11 years ago

radj commented 11 years ago

I am new to Android development (started just this month) and I am already diving into customizing this app. Please bear with me :)

I tried on both Nexus One and S4 virtual devices on Genymotion and it doesn't seem to work. Both virtual devices had Google Play installed so I installed droid VNC server from Google Play.

It always shows "Couldn't start server :(" everytime I try to start it. I adb'd into the virtual device and it turns out /data/data/org.onaips.vnc/lib is empty! No dependency so files were found.

I am not sure yet if this is a Genymotion or Droid VNC apk issue?

hyhjcjy commented 11 years ago

The devices should be root. If the root devices not work, maybe you can try to build the source code by the following command $cd droidVNCserver $ndk-build $./updateExecsAndLibs.sh

Then the .so file will be generated to the droidVNCserver/lib folder.

radj commented 11 years ago

The virtual device is already rooted, it passes with Root Checker Basic.

I will try that. I will also probably try copying from the SO from an installation on a real device and copy it into the virtual device.

radj commented 11 years ago

OK, it may have been a bad idea to copy .so files from real device into emulator due to the difference in architecture. The device is arm(?) and the Genymotion device needs the x86.

So I did the recompilation with the NDK and got the x86 .so files. Still fails. And I can't get anything useful from logcat: V/VNCserver( 2229): Running as root... V/VNCserver( 2229): Starting /data/data/org.onaips.vnc/files/androidvncserver -r 0 -s 100 -P 5901 E/AndroidRuntime( 2381): E/AndroidRuntime( 2381): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<< D/AndroidRuntime( 2381): CheckJNI is OFF D/dalvikvm( 2381): Trying to load lib libjavacore.so 0x0 D/dalvikvm( 2381): Added shared lib libjavacore.so 0x0 D/dalvikvm( 2381): Trying to load lib libnativehelper.so 0x0 D/dalvikvm( 2381): Added shared lib libnativehelper.so 0x0 E/AndroidRuntime( 2381): will FindClass com/android/internal/os/RuntimeInit D/AndroidRuntime( 2381): Calling main entry com.android.commands.am.Am D/dalvikvm( 2381): Note: class Landroid/app/ActivityManagerNative; has 157 unimplemented (abstract) methods D/AndroidRuntime( 2381): Shutting down VM D/dalvikvm( 2381): GC_CONCURRENT freed 92K, 17% free 490K/584K, paused 0ms+0ms, total 0ms I/AndroidRuntime( 2381): NOTE: attach of thread 'Binder_2' failed W/audio_hw_primary( 105): out_write() limiting sleep time 69659 to 23219 W/AudioFlinger( 105): write blocked for 448 msecs, 3 delayed writes, thread 0xb8c4ea90 W/audio_hw_primary( 105): out_write() limiting sleep time 58049 to 23219 W/audio_hw_primary( 105): out_write() limiting sleep time 46439 to 23219 W/audio_hw_primary( 105): out_write() limiting sleep time 34829 to 23219 E/Genymotion( 484): Could not open '/sys/class/power_supply/genymotion_fake_path/present' V/VNCserver( 2229): Could not start server :(

What can I do next?

radj commented 11 years ago

Updates: Still not working but I got these logs from running libandroidvncserver.so from shell:

/data/data/org.anaips.vnc/lib/libandroidvncserver.so -r 0 -s 100 -P 5901
rotating to 0 degrees
scaling to 100%
Initializing grabber method...
No grabber method selected, auto-detecting...
--Loading flinger native lib--
Loading lib: /data/data/org.onaips.vnc/lib//libdvnc_flinger_sdk10.so
Couldnt load flinger library /data/data/org.onaips.vnc/lib//libdvnc_flinger_sdk10.so! Error string: (null)
Loading lib: /data/data/org.onaips.vnc/lib//libdvnc_flinger_sdk14.so
Couldnt load flinger library /data/data/org.onaips.vnc/lib//libdvnc_flinger_sdk14.so! Error string: (null)
--Loading gralloc native lib--
Loading lib: /data/data/org.onaips.vnc/lib//libdvnc_gralloc_sdk10.so
Couldnt load library /data/data/org.onaips.vnc/lib//libdvnc_gralloc_sdk10.so! Error string: (null)
Loading lib: /data/data/org.onaips.vnc/lib//libdvnc_gralloc_sdk14.so
--Initializing gralloc access method--
Error: I have received a bad screen size from gralloc.
--Initializing framebuffer access method--
line_lenght=0 xres=600, yres=1024, xresv=600, yresv=1024, xoffs=0, yoffs=0, bpp=16
Using Droid workaround
mmap failed
Initializing virtual keyboard and touch device...
---Initializing uinput...---
Initializing VNC server:
    width:  0
    height: 0
    bpp:    0
    port:   5901
Colourmap_rgba=0:0:0:0    lenght=0:0:0:0
29/07/2013 14:25:35 Listening for VNC connections on TCP port 5901
29/07/2013 14:25:35 Listening for HTTP connections on TCP port 5801
29/07/2013 14:25:35   URL http://localhost:5801
Unsupported pixel depth: 0
Cleaning up...

Not sure why flinger load fails when I have these files in x86 arch: /data/data/org.onaips.vnc/lib//libdvnc_flinger_sdk14.so /data/data/org.onaips.vnc/lib//libdvnc_gralloc_sdk14.so

Gralloc also seems to have loaded successfully but init fails... I'll try to rebuild libandroidvncserver.so with more debug. I don't know how to do this yet, I'll find my way but tips will help :)

radj commented 11 years ago

Okay, I looked at the logs more carefully and the framebuffer.c code. In the logs, it says:

line_lenght=0 xres=600, yres=1024, xresv=600, yresv=1024, xoffs=0, yoffs=0, bpp=16
..
mmap failed

mmap fails because it is given a zero fbSize. fbSize is zero because line_length is zero.

There is no ioctl error but what does this do?

ioctl(fbfd, FBIOGET_FSCREENINFO, &fscrinfo) != 0
radj commented 11 years ago

I'm starting to compare the logs of a working setup and the failing one. It's only til now that I shouldn't be looking in /data/data/org.anaips.vnc/lib but in /data/data/org.anaips.vnc/files instead.

Working logs:

V/VNCserver( 4211): Running as root...
V/VNCserver( 4211): Starting /data/data/org.onaips.vnc/files/androidvncserver  -r 180 -s 100 -P 5901 
I/VNCserver( 4969): rotating to 180 degrees
I/VNCserver( 4969): scaling to 100%
I/VNCserver( 4969): Initializing grabber method...
I/VNCserver( 4969): No grabber method selected, auto-detecting...
I/VNCserver( 4969): --Loading flinger native lib--
I/VNCserver( 4969): Loading lib: /data/data/org.onaips.vnc/files//libdvnc_flinger_sdk10.so
I/VNCserver( 4969): Loading lib: /data/data/org.onaips.vnc/files//libdvnc_flinger_sdk14.so
I/VNCserver( 4969): Couldnt load any flinger library! Error string: Cannot load library: soinfo_relocate(linker.cpp:975): cannot locate symbol "_ZN7android16ScreenshotClient6updateEv" referenced by "libdvnc_flinger_sdk14.so"...
I/VNCserver( 4969): --Loading gralloc native lib--
I/VNCserver( 4969): Loading lib: /data/data/org.onaips.vnc/files//libdvnc_gralloc_sdk10.so
I/[Gralloc-3X]( 4969): using (fd=9)
I/[Gralloc-3X]( 4969): id           = fb0
I/[Gralloc-3X]( 4969): xres         = 768 px
I/[Gralloc-3X]( 4969): yres         = 1024 px
I/[Gralloc-3X]( 4969): xres_virtual = 768 px
I/[Gralloc-3X]( 4969): yres_virtual = 3072 px
I/[Gralloc-3X]( 4969): bpp          = 32
I/[Gralloc-3X]( 4969): r            = 16:8
I/[Gralloc-3X]( 4969): g            =  8:8
I/[Gralloc-3X]( 4969): b            =  0:8
I/[Gralloc-3X]( 4969): format       =5
I/[Gralloc-3X]( 4969): width        = 94 mm (207.523392 dpi)
I/[Gralloc-3X]( 4969): height       = 151 mm (172.249008 dpi)
I/[Gralloc-3X]( 4969): refresh rate = 58.89 Hz
D/gralloc-3X-ump( 4969): real close fd
I/VNCserver( 4969): Error: I have received a bad screen size from gralloc.
I/VNCserver( 4969): --Initializing framebuffer access method--
I/VNCserver( 4969): line_lenght=3072 xres=768, yres=1024, xresv=768, yresv=3072, xoffs=0, yoffs=0, bpp=32
I/VNCserver( 4969): Initializing virtual keyboard and touch device...
I/VNCserver( 4969): ---Initializing uinput...---
I/VNCserver( 4969): Initializing VNC server:
I/VNCserver( 4969):     width:  768
I/VNCserver( 4969):     height: 1024
I/VNCserver( 4969):     bpp:    32
I/VNCserver( 4969):     port:   5901
I/VNCserver( 4969): Colourmap_rgba=16:8:0:0    lenght=8:8:8:0
I/VNCserver( 4969): Starting IPC connection...
I/VNCserver( 4969): binded to port 13132
V/VNCserver( 4211): RECEIVED ~SERVERSTARTED|

So I checked on the Genymotion setup, and the files are actually there. Whew. I tried running /data/data/org.onaips.vnc/files/androidvncserver manually on the AVD but it doesn't seem to have x86 architecture. How do I build x86 into these binaries in /data/data/org.onaips.vnc/files/?

wangrangli42 commented 11 years ago

I have the same question. But it run well(except the mouse don't work) on the AndroVM which is free version of Genymotion.

paulmai commented 11 years ago

Confirmed, I am also experiencing the same issue. Any ideas on what could be causing this?

gounthar commented 11 years ago

I've got the same issue (mmap failed) with several VNC server apps in Genymotion.

lalinden commented 10 years ago

Well, hello. Iam try to use the app from google play on galaxy S2 and galaxy tab 8 (android 4.x), in both, the app dont work, say that pixel deep is not supported, or something like...

I install the enviroment to build the app with eclipse/ndk, etc.. I can build de project, and run on emulador (api-15), but dont runs on emulator.. the app starts.. but when I try to start vnc in the app, the follow message appear:

..(571): Error! Could not find daemon file, /data/data/org.onaips.vnc/lib/libandroidvncserver.so

Can you have an ideia about this ?

thanks