Android Debugging over Wi-Fi for Gear VR Development

If you're developing for the Samsung Gear VR then you need to know how to debug your app over wi-fi. Since the phone has to be physically disconnected from the PC to be put on the headset, there is no way to get Android debug messages over the USB cable. 
The Android SDK provides the logcat logging utility, which is essential for determining what an application and the Android OS are doing.

ADB provides wireless debugging over Wi-Fi. To enable it follow the steps below.
At your command prompt, type
1. adb devices - You’ll get your device signature if it is connected to the USB
2. adb tcpip 5555 - This will open a port (open the wireless service)
3. Find the IP address of your Android device by going into the device Wi-Fi settings, mine is 192.168.10.10
adb connect 192.168.10.10:5555
Now you can disconnect your phone from the computer and still get the debug messages from your program over wi-fi . Filter your logcat

5. Type adb logcat -s “YOUR_PROGRAM_TAG”
adb logcat -s <tag>
 
To get back to USB debugging
adb usb
 In the native VRLib code, messages can generally be printed using the LOG() macro. In most source files this is defined to pass a tag specific to that file. Log.h defines a few additional logging macros, but all resolve to calling __android_log_print() .

Using Logcat to Determine the Cause of a Crash

Logcat will not necessarily be running when an application crashes. Fortunately, it keeps a buffer of recent output, and in many cases a command can be issued to logcat immediately after a crash to capture the log that includes the backtrace for the crash:

adb logcat > crash.log

Simply issue the above command, give the shell a moment to copy the buffered output to the log file, and then end adb (Ctrl+C in a Windows cmd prompt or OS X Terminal prompt). Then search the log for “backtrace:” to locate the stack trace beginning with the crash.

If too much time as elapsed and the log does not show the backtrace, there a full dump state of the crash should still exist. Use the following command to redirect the entire dumpstate to a file:

adb shell dumpstate > dumpstate.log

Copying the full dumpstate to a log file usually takes significantly longer than simply capturing the currently buffered logcat log, but it may provide additional information about the crash.

Getting a Better Stack Trace

The backtrace in a logcat capture or dumpstate generally shows the function where the crash occurred, but does not provide line numbering. To get more information about a crash, the Android Native Development Kit (NDK) must be installed. When the NDK is installed, the ndk-stack utility can be used to parse the logcat log or dumpstate for more detailed information about the state of the stack. To use ndk-stack, issue the following:

ndk-stack -sym <path to symbol file>-dump<source log file>> stack.log

For example, this command:

ndk-stack -sym VrNative\Oculus360Photos\obj\local\armeabi-v7a -dump crash.log > stack.log

uses the symbol information for Oculus 360 Photos to output a more detailed stack trace to a file named stack.log, using the backtrace found in crash.log.

 

you may want to adb install apk through WIFI

 

adb connect 192.168.10.235:5555
adb install "E:\Documents\Unreal Projects\GearVR\APK\Android_ETC2\GearVR-armv7-es2.apk"

or

adb -r install "E:\Documents\Unreal Projects\GearVR\APK\Android_ETC2\GearVR-armv7-es2.apk"
 if u want to uninstall it, then try this:
//adb uninstall <package>
adb uninstall com.YourCompany.GearVR

or uniostall apk butu keep the data and cache files:

//adb uninstall -k <package>
adb uninstall -k com.YourCompany.GearVR
 

 

watch the CPU and Mermory cache used:

adb shell top

 

 

You may have this issue:

ADB : unable to connect to 192.168.1.10:5555

 

Eliran Kuta ‘s world, Imagine everything is double check over and is okay. then you may need to check like this:

1、Make sure that Aggressive Wi-Fi to Cellular handover under Networking section in the device's developer options is tured off.

2、ping continously from your pc to the device to make sure it's not in network idle mode ping -t 192.168.1.10 (windows cmd), unlock the device and even try to surf to some website just to make it get out of the network idle.

3、When it replies to the ping, connect it via usb, and:

adb usb
adb tcpip 5555
//adb connect <DEVICE_IP_ADDRESS>:5555
adb connect 192.168.10.1:5555
 4、In casr it's still not connected, try to switch the usb connection mode as MTP / PTP / Camera while the device is connected through usb and repeat these steps over again...

 

or trying "adb kill-server", or "adb disconnect <DEVICE_IP_ADDRESS>" then do it again.

 

//android adb devices offline
error: device offline
 trying " adb kill-server ", then " adb start-server ".
1.Settings -> Developer options -> Revoke USB debugging authorizations (clear the list of authorized PCs).
2.Set USB Debugging OFF.
3.In Terminal write : adb kill-server
4.Then : adb start-server
5.Then : adb connect xx.xx.xx.xx:5555 (the devices ip), it should say unable to connect.
6.Now turn ON USB debugging again and type the adb connect xx.xx.xx.xx:5555 again.
It should now ask for authorization and you are back online without needing to connect cable to USB, only wifi.
 
set or change the static ip by adb through wifi
davidt
root@hikey:/ # ip route
0.0.0.0/24 via 192.168.1.1 dev eth0
192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.109
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.151
 or
adb shell

ifconfig eth0 [IP] netmask [NETMASK]
route add default gw [GATEWAY] dev eth0

setprop net.eth0.dns1 8.8.8.8
setprop net.eth0.dns2 4.4.4.4

getprop

//eth0 UP [IP ADDR] [NETMASK] 0x00001043
 
use DDMS to capture the app runtime log :
\android-sdk-windows\tools\ddms.bat
 if consle show u tip: "The standalone version of DDMS is deprecated. Please use Android Device Monitor (monitor.bat) instead." Please run the " monitor.bat " at the same place.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326222436&siteId=291194637