我使用的是android studio 0.8.2,我想从文件中读取数据到数组,但是我得到了这个错误: Cannot resolve symbol FileUtils。该行出错:
todoAppNames = new ArrayList<String>(FileUtils.readLines(todoFile));我已经在应用程序的->库中包含了commons-io-2.4.jar文件
public void readItemsFromFile() {
File fileDir = getFilesDir();//returns absolute path
File todoFile = new File(fileDir, "todo.txt");
try {
todoAppNames = new ArrayList<String>(FileUtils.readLines(todoFile));
} catch(IOException e) {
todoAppNames = new ArrayList<String>();
}
} 如果你需要更多的信息,请让我知道。
发布于 2015-06-28 19:02:49
将jar文件拖到lib的jar文件夹下,右击jar文件,选择"Add as library..“选项。将会打开一个对话框。选择您的应用程序,然后单击OK。这将解决问题。
https://stackoverflow.com/questions/24924634
复制相似问题