Android Studio error 0.9.2 to 0.9.3: toString () method could not be specified

I just updated android studio version from 0.9.2 to 0.9.3 and opening an existing project (which worked with 0.9.2) the following error appears in all '.toString' methods (red underline) (fi Integer.toString): the non-static toString () method cannot refer to a static context. But debugging doesn't show anything and the app works correctly. Any suggestion please?

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 underlined in red with this annotation: "Non-stationary method toString () cannot refer to static context" Upate: replacing "Character.toString (...)" with "Character.valueOf (...)", everything seems to be fine (no red underline). Does this mean the toString method will be deprecated?

+3


source to share


2 answers


This is a common mistake.
The fix will be shipped at 0.9.4 according to this https://code.google.com/p/android/issues/detail?id=79420



+1


source


Try going to File> Invalidate Cache and reload. I just updated and don't have this problem.

change



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

+2


source







All Articles