Android Studio 0.9.2 到 0.9.3 错误 : toString() method cannot be referenced

标签 android android-studio

我刚刚将 android studio 版本从 0.9.2 更新到 0.9.3,并打开一个现有项目(使用 0.9.2 运行)以下错误(红色下划线)出现在所有“.toString”方法中(f.i. Integer .toString): 非静态方法 toString() 不能从静态上下文中引用。但是调试没有显示任何内容,应用程序运行正常。请问有什么建议吗?

例子:

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;
}

'.toString' 是红色下划线的注释:'non static method toString() cannot be referenced from a static context' 更新: 用“Character.valueOf(...)”替换“Character.toString(...)”似乎没问题(没有红色下划线)。这意味着 toString 方法将被弃用?

最佳答案

尝试转到"file">“使缓存无效并重新启动”。我刚刚升级,没有遇到这个问题。

编辑

看起来这是一个 known issue with 0.9.3 .下一个 Canary 版本中应该会提供永久修复。

关于Android Studio 0.9.2 到 0.9.3 错误 : toString() method cannot be referenced,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26937002/

相关文章:

android - TabHost 和 ActionBar

android emulator sdk 10 api 29 重新挂载并重启后不会启动

java - 在原生 android studio 项目 UI 之上渲染 Unity 内容

java - 如何从 Android 应用程序打开 Facebook 应用程序上的个人资料

Android 项目构建失败,检索项目 : No resource found that matches the given name 的父项时出错

javascript - 尝试在 WebView 中调用 javascript 时出现 "Connection to the server was unsuccessful"

android - 如何在 React Navigation 中添加抽屉内部堆栈导航

android - 如何在 onCreate 中使用 findViewById() 而不返回 null?

android - 在android studio中使用REST api根据用户ID获取用户名

android -/sys/fs/pstore 不适用于 poco m3 android,有办法修复吗?