为了账号安全,请及时绑定邮箱和手机立即绑定

工程clean后 报错?

工程clean后不能导入XXXActivity_ 需要重新保存 哪位大哥知道如何解决

正在回答

3 回答


/**

 * 修改文件

 */

public class BUG {


public String read(String filePath) {

BufferedReader br = null;

String line = null;

StringBuffer buf = new StringBuffer();


try {

br = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "GBK"));

while ((line = br.readLine()) != null) {


buf.append(line);


buf.append(System.getProperty("line.separator"));

}

} catch (Exception e) {

e.printStackTrace();

} finally {

// 关闭流

if (br != null) {

try {

br.close();

} catch (IOException e) {

br = null;

}

}

}

return buf.toString();

}


public void write(String filePath, String content) {

BufferedWriter bw = null;

try {

bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath), "GBK"));

bw.write(content);

} catch (Exception e) {

e.printStackTrace();

} finally {

// 关闭流

if (bw != null) {

try {

bw.close();

} catch (IOException e) {

bw = null;

}

}

}

}

/**

* 主方法

*/

public static void main(String[] args) {

// 文件路径

String[] path = new String[]{"D:/Error0Activity.java",

"D:/Error1Activity.java",

"D:/Error2Activity.java"};

BUG debug = new BUG();

for(String filePath : path)

debug.write(filePath, debug.read(filePath)); // 读取修改文件

try {

System.out.println("蛋疼");

} catch (Exception e) {

e.printStackTrace();

}

}

0 回复 有任何疑惑可以回复我~

clean工程后,报错情况如图,需要把每个报错的文件重新 Ctrl + S 一下

5677c36b000140d005000210.jpg

5677c36c00010e2c05000129.jpg


0 回复 有任何疑惑可以回复我~

你把继承的类直接改成Activity就行了

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
懒人必备之Android效率开发框架
  • 参与学习       61374    人
  • 解答问题       72    个

本教程带你学一个快捷方便的Android开发框架,敏捷开发必备

进入课程

工程clean后 报错?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信