美文网首页
DataBinding line 1:0 mismatched

DataBinding line 1:0 mismatched

作者: bitman | 来源:发表于2017-11-01 15:23 被阅读160次

    https://stackoverflow.com/a/39975902/4697179
    原因可看这个链接

    解决方式是写个Groovy脚本文件来找到出问题的文件

    private void findErrFile(String path) {
            File file = new File(path);
            String[] list = file.list();
            if (list == null) {
                System.out.println("=========================路径为空" + path);
                return
            }
            int length = list.length;
            System.out.println("file.size=" + length);
            for (int i = 0; i < length; i++) {
                String onePath = list[i];
                File oneFile = new File(path, onePath);
                FileInputStream fis = null;
                FileReader fr = null;
                char[] b = new char[1];
                try {
                    //                System.out.print("寻找当前文件="+onePath);
                    fr = new FileReader(oneFile);
                    fr.read(b, 0, 1);
                    //                System.out.println("the first c of the file = "+b[0]);
                    if (b[0] == 0xfeff) {
                        System.out.println("=========================当前文件出现异常字符, file=" + onePath);
                    }
                } catch (FileNotFoundException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } finally {
                    if (fis != null) {
                        try {
                            fis.close();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                }
                //            System.out.println("the first c of the file = "+b[0]);
                if (b[0] == 0xfeff) {
    
                }
            }
        }
    

    然后重新新建这个文件 把以前的内容重新复制进去就能解决问题了

    参考自网络的文章实现
    http://www.cnblogs.com/BobGo/p/6344873.html?utm_source=itdadao&utm_medium=referral

    相关文章

      网友评论

          本文标题:DataBinding line 1:0 mismatched

          本文链接:https://www.haomeiwen.com/subject/vlkgpxtx.html