Useless Error Message #516

When your IDE gives you an error message that means nothing at all

Danielle H
2 min readJul 25, 2022

--

After programming for a while in Flutter, I returned to an old Android app to add some features and fix a bug. It’s always confusing to switch between languages — is it semicolon, colon, tabs or parentheses? What’s the syntax for switch again…?

Woman thinking
Google is your friend.

In this case, I wrote the following line in Android Studio:

Uri uri = new Uri.fromFile(file);

And despite the fact that autocomplete easily found fromFile for me, it was colored in red and the enlightening error message was could not resolve symbol 'fromFile'.

What I am supposed to do with that? Uri clearly has a static fromFile function. Googling for “could not resolve symbol” is useless as it is a general error.

google results for search, could not find ‘File’

So… what do I do now?

In the end I found an obscure site with the answer: Changing languages is confusing :)

In Flutter, there is no need for the new keyword. You just call the constructor, or the helper function:

TextButton button = TextButton(child:Text("Hi!");

TextButton button = TextButton.icon(icon:icon,label:Text("Hi!"));

In Java, however, the new keyword is important, but only when calling the constructor, not the helper function:

Uri uri = new Uri();//This constructor doesn't actually exist

Uri uri = Uri.fromFile(file);

In other words, all I needed to do was remove the new keyword and everything was fine. So the error message should have been Uri.fromFile is not a constructor or new keyword is redundant or even could not find constructor instead of the completely useless error message that was given.

What useless error messages have you encountered? Write in the comments and let me know :)

--

--

Danielle H

I started programming in LabVIEW and Matlab, and quickly expanded to include Android, Swift, Flutter, Web(PHP, HTML, Javascript), Arduino and Processing.