I’m having some trouble trying to get gradle to play nice with adb tcpip.
To provide a little background, I am working on an android device and am trying to run gradlew cC so that it will run tests which I have written. I am trying to run the command from both my local machine and a server (which the device cannot be connected to). In order to deal with this I am using adb tcpip in order to have the device be detected by the server. I cannot get the server to run the command because it continues to crash when it tries to run the connectedProductionDebugAndroidTest task that gradlew cC executes. the cC command is able to run from my local machine both when connected to the device via usb and when connected to the device via adb tcpip.
The exact error I am getting is…
12:26:26 E/151701730: null com.android.ddmlib.ShellCommandUnresponsiveException at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:511) at com.android.ddmlib.Device.uploadAPK(Device.java:1028) at com.android.ddmlib.Device.installPackages(Device.java:902) at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:113) at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:130) at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:49) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
Unable to install path_to_project/app/build/outputs/apk/app-development-debug.apk com.android.ddmlib.InstallException: Unable to upload some APKs at com.android.ddmlib.Device.installPackages(Device.java:920) at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:113) at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:130) at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:49) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
com.android.builder.testing.ConnectedDevice > runTests[AOSP on HammerHead] FAILED com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Unable to upload some APKs at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:117) null com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Unable to upload some APKs at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:117) at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:130) at com.android.builder.internal.testing.SimpleTestCallable.call(SimpleTestCallable.java:49) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.android.ddmlib.InstallException: Unable to upload some APKs at com.android.ddmlib.Device.installPackages(Device.java:920) at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:113) ... 8 more :app:connectedDevelopmentDebugAndroidTest FAILED
When I try to run the gradle script from android studio it also complains about this at the very top of the output.
Failed to complete Gradle execution.
Cause:
invalid stream header: 01000001
I don’t think it is something wrong with the tests themselves. Using adb only I am able to run all my tests with no problems over adb tcpip (the reason I want to get it to work with gradle is to have access to the test reports). I know that this is how gradle invokes the tests as well so perhaps it is an issue with the precise flags and arguments it uses. I also don’t think it is an issue with how we have gradle set up in our project because the command will successfully execute from my local machine when connected to the device using adb tcpip. Does anyone have any thoughts on what could be causing this issue? I have been looking around for a while but nothing I have tried seems to work.
Not sure if this is relevant:
Originally, I could not get the gradlew cC task to run from command line on my local machine either. However after running it once from android studio it suddenly began working from command line, even if I make changes to the gradle file or my tests