I've been using ARCore and Unity to develop an app for a few months and was having a great time developing with Instant Preview until recently. For whatever reason no matter what I try I'm unable to get the ARCore Instant Preview app to show any status other than "Not connected to editor" with a red box.
Usually restarting my device and computer would solve this issue, but I've been doing that for days now without success. I can see my device listed as connected in ADB, and I've tried both USB and WIFI connections. I know it's connected because launching the app in Unity causes the Instant Preview app to open up or install if I've uninstalled it.
I'm at my wits end on what could be going on here. I'm running Unity 2018.2.3 on Windows 10, and my device is a Pixel XL running the latest Android 9 (Pie). I made several new projects and imported the latest ARCore unity package, but they all experience the same issue even when I create them in 2018.1.9.
Logcat hasn't been much help either, attached is a snippet of the output from when I try and run the app through Unity. It throws hundreds of "io.grpc.StatusRuntimeException: UNAVAILABLE: End of stream or IOException" errors at the end, but I can't tell where it broke before that.
Thanks for reading, any help you could provide would be greatly appreciated.
Hi, thanks for the report. Just in case it helps, did you look at the existing InstantPreview issues and you relate your experience to any of them, or you think this is a new one? Thanks!
I've scoured all the forums I could find, and as far as I can tell it's new. Before I was always able to fix the connection after either killing the adb server and restarting, or restarting the device and my computer like the many other issues suggest.
That had always worked in the past, but doesn't anymore. The newest variable I can think of is my recent upgrade to Android Pie, maybe there's an issue there? What really throws me for a loop is why the device shows connected but the app does not.
I lack the understanding of how Instant Preview connects to a phone and transfers the video feed, so I'm not sure how I can debug it further. I've seen a few posts that mentioned checking ports and running commands like netstat -ano | findstr 49838 but when I do the same I don't see anything with that id or port number.
I hope this clarifies things a bit. Thanks!
I've continued in vain to try and get instant preview to work. I've rolled back my phone to an earlier version of android, run previous versions of the ARCore unity package, completely removed Unity and Unity Hub and reinstalled the latest version of Unity, short of re-installing windows I don't know what I can do.
In debugging the instant preview scripts, I have observed the code executing the shell command shell am start -S -n com.google.ar.core.instantpreview/.InstantPreviewActivity which executes successfully, opens up the instant preview app on my phone, and returns this output with no errors:
Stopping: com.google.ar.core.instantpreview
Starting: Intent { cmp=com.google.ar.core.instantpreview/.InstantPreviewActivity }
The logcat entries immediately around this action do not give an indication of anything failing, but right after the "beginning of main" section the terminal is blasted with the above "UNAVAILABLE: End of stream or IOException" error. Based on that error I'd guess that either my computer is not sending something it needs to, or the app is unable to receive it.
I don't know how else to debug this issue without some understanding of the InstantPreview.apk. I can't seem to find the source for that anywhere. Can that source code be made available? Or at least could you let me know if there's anything else I can do to debug this? I'd really love to get this working again.
@pablisho I think you can close this issue, I was able to resolve my issues by initiating the nuclear option and completely reinstalling windows. No matter what I did before, I wasn't able to get Unity to open port 49838. I reinstalled it and the android sdk several times, and even removed all references to Unity from ProgramData, AppData, and the registry, with no effect.
I play around with a lot of different tech, so it's possible that somewhere along the line I introduced something that was interring with Unity's ability to communicate with ADB (possibly the duplicate AndroidSDK that was installed by VS2017, or NVIDIA CodeWorks used for Unreal Engine 4). I hope these details can help anyone experiencing similar problems.
@Dodecadaemon I feel like this issue should be re-opened. My co-workers and I have run into several problems like this with ARCore's Instant Preview, and nothing seems to be "consistent" fix. Reinstalling your OS is ridiculous.
It seems like their script properly find the embedded version of ARCore Instant Preview, however it appears like the device isn't being recognized through Unity, via ADB.
05-14 11:50:08.448 23458 23483 I InstantPreviewConnection: trying reconnect
05-14 11:50:08.448 23458 23483 I InstantPreviewConnection: onError: io.grpc.StatusRuntimeException: UNAVAILABLE: End of stream or IOException
I am getting this kind of error in adb logcat