Smart Dashboard Error

We’re suddenly getting this error in our code.
This part of the code:
SmartDashboard.getNumber("Base Drive Level ", 0)

Has this error:
The type edu.wpi.first.wpilibj.tables.TableKeyNotDefinedException cannot be resolved. It is indirectly referenced from required .class files

Does anyone have any idea why that is?

You’re using a library that uses the WPILib library. Yet the WPILlib specific library where that exception lives isn’t in the deployed environment.

i.e. your dependencies have dependencies, which you need to track down. For example, if you’ve just included the SmartDashboard jars into your local project and launching that from Eclipse, you’ll also need the WPILib specific jars included in the project.

IF you’d be up for it, GradleRIO does wonders for this type of thing. It manages dependencies internally. It’s relatively simple to learn, and plenty of people around here are willing to help! If (e.g.) you have a folder of jars you want included, I can help you with the Gradle config for that.

This sounds like a wonderful tool, how do I start?

How comfortable are you with the command line?

If you can do the setup on the command line, you can do the rest from Eclipse. GradleRIO recommends Windows users use PowerShell. Personally, I like the terminal provided by git-scm since it’s more Unix-centric. If you’d like I can walk you through some basics with the command line to get it setup.

I’m fine with using command line Jesse.

My first question before starting is where do I put the Quickstart.zip? We are using Eclipse, so I’m thinking it goes in our workspace folder Users/username/eclipse-workspace

If your workspace is

Users/username/eclipse-workspace

then you unzip the quickstart.zip to

users/username/eclipse-workspace/<project>

In the folder where you see .classpath and .project, you should also see build.gradle

You’ll then want to delete the project from eclipse (but don’t delete its contents on the disk!), then go to File -> Import… -> Gradle Project

2017-11-28_2001.png

I unzipped the quickstart in the project folder, then imported the project. When I use terminal ‘./gradlew eclipse’ I get a permissions issue; I’m logged in as administrator.

What would have happened if that command worked?

sudo got me command not found. Tried:

Pauls-MBP:java PaulC$ sudo ./gradlew build
Password:
sudo: ./gradlew: command not found

Pauls-MBP:java PaulC$ ls
build.gradle gradle gradlew gradlew.bat src

./gradlew eclipse generates some files. That’s about it.

Are you running Windows 10 by any chance? Windows has been really, really annoying about my programming tools lately.

Edit: Try chmod +x gradlew

I’m using a Mac running OSX 10.13.1

chmod was able to allow the gradlew command to do something; gradlew build, got the same error

Pauls-MBP:java PaulC$ chmod +x gradlew
Pauls-MBP:java PaulC$ chmod +x gradlew build
chmod: build: No such file or directory
Pauls-MBP:java PaulC$ chmod +x gradlew build
chmod: build: No such file or directory
Pauls-MBP:java PaulC$ chmod +x gradlew
Pauls-MBP:java PaulC$

chmod just makes gradlew an executable. Try running

./gradlew eclipse

now.

That did it! I ran this on a small tank drive project that was on my laptop. I don’t have access to the code we were having that library error that started this thread as we ended our team meeting.

If I had, would this build process have inserted the necessary dependencies?

If we use this for builds, do we no longer care about importing libraries?

How do we see what Gradle did to the source code post build?

Keep forgetting to Thank You for all your help so far!

Gradle doesn’t change the source code - it compiles it.

You still have to import libraries, and tell gradle which dependencies to use, and how. GradleRIO (which is a plugin for gradle) does this for most FRC stuff. If you want to use a library GradleRIO does not include, you’ll have to add it to the build.gradle yourself. I would recommend taking a look at the build.gradle anyway, as it has some things which you might want to change (team, robot class, etc.) and is how you update plugins (GradleRIO) and dependencies.

The result of the compilation should be in /build/libs

If you want to see a real robot project using this, check out this - I ported my teams code to gradle(RIO) during the offseason (basically for fun; I’m not sure anyone on the team knows about it). It has both 2017 and 2018 beta branches, which you can compare to see how easy it is to update using gradle.

Glad to hear this worked out!

For more complex Gradle setups, checkout my team’s Github for 2017 & 2018 (link in the signature). We’re setting up 2018’s project structure now, and experimenting with a few potential code frameworks.