Unable to connect to Control Hub in Android Studio Ladybug

Previous versions of SDK would connect to Control hub when connected via USB-C port and allow Built version of Op-Mode to download to device. Latest SDK with Latest Android Studio Ladybug needs the user to create a Run Configuration to tell the software where to download Op-mode and upgrade to Version 10.1 of Robot Controller. Control Hub shows up in Device Manager window in Android Studio as Physical connection. Using Windows 11. Also tried to connect via WiFi but would not find control hub.

Thanks for the bug report. We’re looking at our options now. The last version we checked ourselves was Koala, I highly recommend uninstalling LadyBug and downloading the most recent patch of Koala from here:

https://developer.android.com/studio/archive

So this post induced me to update to Android Studio Ladybug.

And that was a bit of a challenge.

Not only has JetBrains rewritten the entire UI so that it’s a VSCode lookalike and hence I no longer know how to find anything, but Android Studio now ships with JDK 21 by default.

Upon initial load of the FtcRobotController workspace in Android Studio Ladybug, the gradle sync/build fails because of an incompatibility between our version of gradle and Android Studio Ladybug’s bundled JDK.

Android Studio rather unhelpfully suggests you update gradle. We do not suggest users update gradle as FIRST has not tested and evaluated versions beyond 7.4.2. If you do this, we can not provide support for the uprev gradle versions.

I was able to get Ladybug to build and deploy FtcRobotController by doing the following.

  1. Install the Classic UI plugin so that I get the UI controls I am familiar with back. You may not have to do this, but I found it helpful because diagnosing one problem is easier than diagnosing two problems.

  2. Install JDK 17 If you did not already have this installed independently of Android Studio. e.g. If you were using Android Studio’s bundled JDK, then when Ladybug is installed Android Studio will unhelpfully overwrite your old bundled JDK version. Note there’s a bug in the Settings → Build Tools → Gradle dialog that may make you think your old version of the JDK is there, but it is not. You must use an unbundled version of the JDK.

  3. Go to File → Settings and under Build, Execution, Deployment → Gradle use the Add JDK from disk option to select the newly installed JDK 17. In the image below take careful note of the directory paths for the options labelled jbr-17 and jbr-21. Note that they are the same. This is the aforementioned UI bug, and that is Android Studio overwriting your old JDK. In this image you’ll see I’ve selected the JDK that was installed independently.

Once that was done, and the project was resynced, the run configurations appeared as normal and the Control Hub appeared in the target deploy box. I’m connecting over wireless adb, but I presume it would be the same over wired usb.

Alluded to in the prior post, but not actually shown, the initial load of the FtcRobotController workspace in Android Studio Ladybug may produce an error recommending the user upgrade Gradle.

Note. All images here are shown with the JetBrains Classic UI plugin installed. If you have not installed that plugin, your UI will be different. This author recommends you install the Classic UI plugin to make these instructions easier to follow.

e.g.

As mentioned before, we do not recommend you update gradle, but if you did click on one of those blue links, you will be presented with another, much more indecipherable error.

To recover, you need to rollback the changes that Android Studio made upon that click.

To do that select Git → Uncommitted Changes → Show Shelf

That will show the changes you have in your workspace. You want to rollback the 4 gradle files shown in the following image. You can either select the Changes checkbox to select all files, or individually select the gradle files. Note that if you have changes in your workspace that haven’t been committed, you want to be careful not to select those files or you may lose work.

Once you have the proper files selected, click the Rollback button.

Resync and that should revert you to the error that prompted you to upgrade Gradle in the first place. From there follow the instructions above to install JDK 17.