google / gapid

Graphics API Debugger
https://gapid.dev
Apache License 2.0
2.2k stars 327 forks source link

Unable to connect to Android device #525

Closed ZephyroalJC closed 7 years ago

ZephyroalJC commented 7 years ago

screen shot 2017-06-07 at 6 51 15 pm I'm really excited about this tool, but currently I can't let gapic connect to my device, the log shows: Zephyr-MacBook-Pro:gapid zephyr$ ./do run gapic [0/1] Install the project... -- Install configuration: "Release" -- Up-to-date: /Users/zephyr/gapid/release/pkg/./gapir -- Up-to-date: /Users/zephyr/gapid/release/pkg/./gapis -- Up-to-date: /Users/zephyr/gapid/release/pkg/./gapit -- Up-to-date: /Users/zephyr/gapid/release/pkg/./lib/VirtualSwapchainLayer.json -- Up-to-date: /Users/zephyr/gapid/release/pkg/./lib/libVkLayer_VirtualSwapchain.dylib -- Up-to-date: /Users/zephyr/gapid/release/pkg/./lib/libgapii.dylib -- Up-to-date: /Users/zephyr/gapid/release/pkg/./lib/GraphicsSpyLayer.json -- Up-to-date: /Users/zephyr/gapid/release/pkg/./strings/en-us.stb -- Up-to-date: /Users/zephyr/gapid/release/pkg/./build.properties I20170607-185306927[main][server.GapiPaths.checkForTools] Looking for GAPID in /Users/zephyr/gapid/release/pkg -> /Users/zephyr/gapid/release/pkg/gapis I20170607-185306945[server.ChildProcess-gapis][server.ChildProcess.runProcess] Starting gapis as [/Users/zephyr/gapid/release/pkg/gapis, -log-file, /var/folders/07/j29gqrf54dg7kh5hkdchw24r0000gn/T/gapis.log, -log-level, Info, -gapir-args, --log /var/folders/07/j29gqrf54dg7kh5hkdchw24r0000gn/T/gapir.log --log-level I, --strings, /Users/zephyr/gapid/release/pkg/strings, --gapis-auth-token, 5gGqsuxG, --idle-timeout, 10000ms] I20170607-185306994[server.ChildProcess$LoggingStringHandler][server.ChildProcess$LoggingStringHandler.lambda$new$0] gapis: 10:53:06.993 I: <gapis> Logging to: /var/folders/07/j29gqrf54dg7kh5hkdchw24r0000gn/T/gapis.log I20170607-185307017[server.ChildProcess$LoggingStringHandler][server.ChildProcess$LoggingStringHandler.lambda$new$0] gapis: Bound on port '56713' I20170607-185307018[server.ChildProcess$LoggingStringHandler][server.GapisProcess.lambda$createStdoutHandler$2] Detected gapis startup on port 56713 I20170607-185307019[server.ChildProcess$LoggingStringHandler][server.GapisProcess.lambda$new$1] Established a new client connection to 56713 I20170607-185307065[server.ChildProcess$LoggingStringHandler][io.grpc.internal.ManagedChannelImpl.<init>] [ManagedChannelImpl@55105e05] Created with target localhost:56713 I20170607-185307191[main][Server.fetchServerInfo] Server info: name: "Zephyr-MacBook-Pro.local" version_minor: 2 E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] LoadData error E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] com.google.gapid.server.Client$InternalServerErrorException: Invalid path: device<0000000000000000000000000000000000000000> Cause: Invalid path 'device<0000000000000000000000000000000000000000>': ID 'id' is invalid E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.gapid.server.Client.throwIfError(Client.java:183) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.gapid.server.Client.lambda$get$1(Client.java:74) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractTransformFuture$AsyncTransformFuture.doTransform(AbstractTransformFuture.java:211) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractTransformFuture$AsyncTransformFuture.doTransform(AbstractTransformFuture.java:200) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:130) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:653) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractTransformFuture$TransformFuture.setResult(AbstractTransformFuture.java:245) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:177) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:435) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:900) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:811) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:653) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at io.grpc.stub.ClientCalls$GrpcFuture.set(ClientCalls.java:461) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:440) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:481) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:398) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:513) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at io.grpc.internal.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:154) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) E20170607-185314353[grpc-default-executor-1][models.Devices$3.onRpcThread] at java.lang.Thread.run(Thread.java:745) screen shot 2017-06-07 at 7 00 12 pm Anyone can help?

ben-clayton commented 7 years ago

Hi @ZephyroalJC - thank you for the bug report - funnily enough @pmuetschard is working on this issue right now.

I believe if you add adb to your path ($ANDROID_SDK/platform-tools), then this will work.

Sorry for the trouble. We'll improve this very soon.

ZephyroalJC commented 7 years ago

hi @ben-clayton , thanks a lot. I had already added the platform-tools to PATH, image

Also, I'd applied your commit manually: image But everything keep the same, should I rebuild the entirely GAPID? Thanks again.

ben-clayton commented 7 years ago

Humm, okay, that's odd then.

Do you get the Android device show up if you run ./do run gapit devices ? If so, does it have a non-empty Serial and Name?

pmuetschard commented 7 years ago

Looking at the screenshot, the log shows the UI requesting a device with a zero ID. The UI never constructs IDs, so gapis' getDevices must have returned a path with a zero device ID.

ben-clayton commented 7 years ago

The UI never constructs IDs, so gapis' getDevices must have returned a path with a zero device ID.

Yup, that's why I'd like to see the output of gapit devices.

martinpelant commented 7 years ago

I'm getting the same error ./do run gapit devices returns following

https://gist.github.com/anonymous/c0c6a904e36a71e86ead1c953b548071

adb devices recognizes my Pixel normally

List of devices attached
FA69Y0303804    device
echo $ANDROID_SDK
/opt/android_sdk
which adb
/opt/android_sdk/platform-tools/adb
ben-clayton commented 7 years ago

Hi @ZephyroalJC, thanks for the information.

The lines:

15:37:17.683 W: <gapis> Couldn't find gapid.apk for device. Error: Opening gapid.apk
   Cause: open /Users/pelant/gapid/release/bin/android-armv8a/gapid-aarch64.apk: no such file or directory

Are very suspect - this sounds similar to https://github.com/google/gapid/issues/315.

Please can you confirm that gapid-aarch64.apk does not exist? If so, please try a rebuild with: ./do clean && ./do build?

martinpelant commented 7 years ago

Found where the issue was. when doing config I specified /opt/android-ndk instead of a specific version /opt/android_ndk/android-ndk-r15 and only found that because I was looking in the logs in the correct time because the build continued anyways with more logs filling up the screen.

-- Building GAPID 0.4.0:0:developer
-- Disable aarch64, missing /opt/android_ndk/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-gcc
-- Disable armeabi, missing /opt/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc
-- Disable x86, missing /opt/android_ndk/toolchains/x86-4.9/prebuilt/darwin-x86_64/bin/i686-linux-android-gcc

Now I have another problem: Failed to connect: EOF when trying to capture trace but I guess it's not in the scope of this issue: https://gist.github.com/martinpelant/6394affe2cda61d919109ac3a6c3cc6c

ben-clayton commented 7 years ago

Hi @martinpelant.

Sorry for getting your name wrong in the previous message.

Good spot. We should certainly fail the build if we're missing toolchains.

If EOF message likely means the application terminated before a connection was made. Is there anything useful in logcat?

Cheers.

joelteply commented 7 years ago

EOF could just mean android studio is open or something else is using adb

ben-clayton commented 7 years ago

Closing issue due to inactivity.