3

I have just updated android studio release from 0.9.2 to 0.9.3 and opening an existing project (that was running with 0.9.2) the following error (red underline) appears in all '.toString' methods (f.i. Integer.toString): non static method toString() cannot be referenced from a static context. But the debug does not show anything and the app runs properly. Please any suggestion?

example:

private String read(String nomefile)
{
    String dati=null;
    try{
        FileInputStream fin=openFileInput(nomefile);
        int c;
        String temp="";
        while ((c=fin.read())!=-1)
        {
            temp=temp+Character.toString(((char)c));
        }
        dati=temp;
    } catch (FileNotFoundException e1) {
        e1.printStackTrace();
    } catch (IOException e1) {
        e1.printStackTrace();
    }
    return dati;
}

and '.toString' is red underlined with this annotation: 'non static method toString() cannot be referenced from a static context' Upate: replacing “Character.toString(...)” with “Character.valueOf(...)” seems all ok (no red underline). This means that toString method will be deprecated?

Moebit
  • 39
  • 7

2 Answers2

2

Try going to File > Invalidate Caches & Restart. I just upgraded and do not have this problem.

edit

It appears this is a known issue with 0.9.3. A permanent fix should be available in the next Canary release.

Jeffrey Mixon
  • 12,846
  • 4
  • 32
  • 55
1

It's a common bug.
The fix is going to be delivered at 0.9.4 according this https://code.google.com/p/android/issues/detail?id=79420

Rafael
  • 6,091
  • 5
  • 54
  • 79