Workflow for debugging? — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Workflow for debugging?

rainabbarainabba Posts: 45
Brain Burst
edited September 2015 in Oculus Go Development
I push an app from Unity, have to put my device in the GearVR to run/test, get an exception, but can't logcat because the device in in the GearVR (and I don't have root to run adb over wifi).

There a standard pattern to dealing with this aside from logcat after reconnecting and combing through TONS of messages?

Comments

  • drashdrash Posts: 2,846
    Neo
    edited December 2014
    You don't need to root to run ADB over wifi. Here are the batch files I use in my workflow:

    Connect:
    (Use whatever IP is listed in your Wifi settings, and the first time you do this you will need to be connected via USB)
    adb tcpip 5555
    adb connect 192.168.1.etc
    pause
    

    List connected devices:
    (To make sure it's connected over wifi - sometimes it won't show up immediately after connecting)
    adb devices
    pause
    

    Start capturing log:
    (Delete old log file, clear out old/pending log data on device, start capturing new log data to new log file. To stop capturing, just close the command window or Ctrl+break, etc. Then you can look at your new android_log.txt and see what's going on)
    del E:\AndroidLog\android_log.txt
    adb logcat -c
    adb logcat -s Unity:D > E:\AndroidLog\android_log.txt
    
    Note that this only captures the Unity messages to avoid seeing a ton of stuff you're not interested in, but there are a bunch more that you can capture if you need additional detail from another module, like this:
    adb logcat -s Unity:D UnityPlugin:V OVR:V VrApi:V VrLib:V ThermalEngine:V VRManagerService:V TimeWarp:V > E:\AndroidLog\android_log.txt
    

    Disconnect device from Wifi:
    (You'll want to do this before you start pushing a new APK, otherwise it will try to push it wirelessly which can take a very very long time. If it's connected over wifi and connected via USB at the same time, it tends to choose the wifi connection.)
    adb disconnect 192.168.1.etc
    adb devices
    pause
    

    Starting ADB server:
    (Sometimes something gets messed up and you'll need to start ADB)
    adb start-server
    pause
    

    Push your app to the device:
    (This can be useful if you want to just Build instead of Build&Run in order to have more visibility into what you're doing. I find that uninstalling first also gives me peace of mind to ensure the old program is uninstalled and therefore if you run the new one, you know for sure it's the new version!)
    adb uninstall com.yourcompany.yourpackagename
    adb install YourAPKName.apk
    pause
    


    There might be better ways of doing this stuff, but this has worked for me well enough for the time being.
  • My hack for quickly testing scenes is to comment out the following line from the manifest.xml file.

    "<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>"

    This removes the requirement to put the phone in GearVR. Head tracking wont work but you can turn the OVRPlayerController by swiping the screen. This also allows me to view the unity profiler info at the same time.

    Like I said, its a quick easy hack to make sure things actually run and to view some basic performance numbers.
  • rainabbarainabba Posts: 45
    Brain Burst
    Both outstanding suggestions. Thank you!
  • rainabbarainabba Posts: 45
    Brain Burst
    ADB over WiFi is priceless. I can even deploy from unity over it, but now I have a new challenge as using the gearVr all the time is cumbersome and it's not always needed, but building twice is no fun either (vr_only AND vr_dual). That said:

    When using vr_dual, how do I run in the GearVR? If I start my app then plug it in, Oculus Home takes over and I haven't figured out if/how to show my app there so I can't start it once I'm in Home. I've tried going in and using adb shell am start -n to start my activity also, but it flashes and I'm back to Home so thus far, vr_dual isn't "dual", it's "vr_novr". Suggestions?
  • tozz3rtozz3r Posts: 60
    Hiro Protagonist
    steve108 wrote:
    rainabba wrote:
    ADB over WiFi is priceless. I can even deploy from unity over it, but now I have a new challenge as using the gearVr all the time is cumbersome and it's not always needed, but building twice is no fun either (vr_only AND vr_dual). That said:

    When using vr_dual, how do I run in the GearVR? If I start my app then plug it in, Oculus Home takes over and I haven't figured out if/how to show my app there so I can't start it once I'm in Home. I've tried going in and using adb shell am start -n to start my activity also, but it flashes and I'm back to Home so thus far, vr_dual isn't "dual", it's "vr_novr". Suggestions?

    I am facing the same issue. I put vr_dual and have a button that enables all of the OVR components.

    I hit the button, all of the components enable, I insert the device, and I get head tracking and a VR view for about 3 - 5 seconds before Home appears and my app is not even listed as an option.

    If I use vr_only with absolutely nothing changed, it works. That rules out any possibility it is a missing activity, missing signature, misplaced components, etc etc. It seems to be that Home doesn't recognize the flag and stand down.

    After taking a bunch of logs and trying to get the app to keep running, it looks as through the triggered DOCK_EVENT causes home to be put ahead of the application.

    Did any of you figure this out?
    The Oculus Home loads in the background everytime.
  • mikeh9mikeh9 Posts: 19
    You can also record the screen over wifi so you can play back a mp4 movie later with this command

    adb shell screenrecord /sdcard/demo.mp4

    IndoTraq.com
    "Combining indoor tracking with virtual reality to give a whole new experience"
  • jkimovrjkimovr Posts: 53
    There is still some work that needs to be done to allow for proper hybrid app development. We'll have more information about vr_dual in a future release of the mobile SDK.

    In the meantime, to prevent Home from launching onDock, run the full retail setup process by downloading the initial apps and finish the tutorial. Adjust your manifest to use the "launcher" intent and also set vr app mode to vr_only. If you now launch your app from the Android screen, you should see a dialog asking you to plug into the headset. You should see your app load.

    If that doesn't work, try the following:

    1) Install your app as a vr_only app making sure you have the correct osig for your device.

    2) Go to your device Settings -> Application manager -> Gear VR Service (usually in the "Downloaded" section but could also be in the "All" section).

    3) Tap on "Manage storage"

    4) Tap the "VR Service Version" number six times.

    5) Wait for scan process to complete and you should now see the Developer Mode toggle on this screen.

    6) If you have your manifest file setup correctly you should be able to see your app on the Android 2D screen - android.intent.category.LAUNCHER

    7) You should now be able to launch your app without the headset and also dock the headset at any time without having Home launch.

    Make sure you still follow the submission guidelines and adjust your manifest accordingly when you're ready to submit your app to Oculus. The instructions above are just to help with the question in this post.

    Submission guidelines as well as other useful documentation can be found here - https://developer.oculus.com/documentation/#filter=mobile
  • SoylentGrahamSoylentGraham Posts: 25
    Brain Burst
    I'm currently trying to get an app to run outside Oculus home (and when undocked if possible)
    jkimovr wrote:
    7) You should now be able to launch your app without the headset and also dock the headset at any time without having Home launch.
    I'm struggling to get this working. I have vr_only, LAUNCHER (these are the defaults with the current sdk; ovr_mobile_sdk_20150106) and my package name is set to com.xxx.xxx (my only change in the manifest)
    Currently my app when launched undocked from the OS prompts to dock with the GearVR. I dock it, and my app (Not oculus home) launches.
    I undock and my app stops. (Not crash)
    jkimovr wrote:
    6) If you have your manifest file setup correctly you should be able to see your app on the Android 2D screen - android.intent.category.LAUNCHER
    Do you mean, my app should show along with the Developer Mode toggle? (which is visible) or my app should launch undocked?

    If I dock without launching my app, my app is not visible in Oculus home (I guess because it's set as LAUNCHER, not INFO? which is fine)
  • cyberealitycybereality Posts: 26,156 Oculus Staff
    Your app won't show up in Oculus Home until it's live on the store.
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i
    Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
  • SoylentGrahamSoylentGraham Posts: 25
    Brain Burst
    Your app won't show up in Oculus Home until it's live on the store.
    If that's a reply to me... I'm not trying to have it show up in Home...
    I'm trying to get my app to launch undocked, then dock it, without home launching. Which I thought @jkimovr was describing in the 2nd half of his post.
    Am I mistaken? Can I NOT have one APK run both docked and undocked?
    jkimovr wrote:
    7) You should now be able to launch your app without the headset and also dock the headset at any time without having Home launch.
  • VisionPunkVisionPunk Posts: 3
    NerveGear
    Starting and stopping the app via ADB can be very handy to avoid USB port wear and tear. For example: the app crashes and you want to restart it without rebuilding to try and find a repro case. Taking out the phone just to tap the icon quickly gets boring. This really helps and will override Oculus Home.

    start.bat
    adb shell am force-stop com.Oculus.UnitySample
    adb shell am start -n com.Oculus.UnitySample/com.unity3d.player.UnityPlayerNativeActivity
    
    stop.bat
    adb shell am force-stop com.Oculus.UnitySample
    
    "com.Oculus.UnitySample" here being the default "Bundle Identifier" that is set in Unity Editor -> Edit -> Project Settings -> Player -> Other Settings -> Identification.
  • artyom17artyom17 Posts: 319 Oculus Staff
    Do you guys use adb over wi-fi? Is it ridiculously slow for you too? Any tips to make it faster?
  • drashdrash Posts: 2,846
    Neo
    artyom17 wrote:
    Do you guys use adb over wi-fi? Is it ridiculously slow for you too? Any tips to make it faster?
    I'm also curious if there's a way to speed this up too - it's ridiculously slow to push an APK over wifi for me as well, but otherwise it seems to capture logcat and all that just fine. So, whenever I push a new build onto the device, I have to drop the wifi connection first.
  • artyom17artyom17 Posts: 319 Oculus Staff
    And seems like Tegra Tools don't work over wi-fi still (they are used for UE4 + Android)... Doh...
  • SvenVikingSvenViking Posts: 298
    Art3mis
    For me it seems about the same as over USB, but it's considerably faster than both to copy and install the APK over WiFi manually using ES File Explorer. Also, sometimes when pushing via ADB it pauses indefinitely until I turn the Note 4 screen on. Note that my game is 64MB.
    Scorched Battalion - VR Jam edition available for Gear VR and DK2 (Win/Mac/Linux)
    Jungle Juice
    Sven Co-op
  • HappySliceHappySlice Posts: 36
    Brain Burst
    This thread is great. Thanks for the tips, everyone.

    I am still having difficulty finding why my application is running so poorly on my phone from getting WaitForPresent hiccups in the Unity Profiler, despite seemingly falling well within the script execution time and vert/tri & drawcall recommendations.

    While running ADB I cannot find the filters to get the concise and slick output as seen here in this Oculus GearVR Developer Blog (Does Chris browse the forums?):
    https://developer.oculus.com/blog/squee ... continued/

    I can render a room with a plane and a cube in the middle and still get WaitForPresent hiccups. Sometimes I wonder if something on my device (T-Mobile Note 4 on Android 4.4.4) or in my Android SDK building the actual .apk is flawed somehow.
    In regard to that matter, we'll see after I build my new machine whenever Intel actually gets supply of their new 6700k chips to online stores.

    Any suggestions are appreciated.
Sign In or Register to comment.