在原有项目删除文件时多删除了文件,导致编译报错,出错原因是找不到databinding文件。
出现的第一个错误是:
Generated class list does not exist {module root}\build\intermediates\data-binding-info\release_generated.txt
编译错误看不出什么,所以编译参数加上-s 或者-i 能查看到更多信息。
没有找到原因,只能回退,回退一次,编译一次。
中间用了git的bisect功能,但这个功能貌似不是hard reset,所以有点麻烦。只能手动reset hard。
rebuild project报错,然后在Event Log中找到对应的task:

手动在右侧的gradle中选中执行,单个任务执行没有问题。

奇怪。按照提示编译的时候加上stacktrace 和info,开启debug。

但因为每次都要手动输入比较麻烦,所以在as的设置里面加上了编译参数。

然后每次根据编译错误的日志进行修改,多试几次最终成功了。
后面发现如果加上了--scan ,就会编译错误,如果去掉就失败,神奇了。
另一种方式 invalidate cache and restart 也可以尝试下。但这次并没有成功,反而是加上--scan成功了。
但是莫名其妙的好了,还不知道原因,心慌慌。ε=(´ο`*)))
https://docs.gradle.org/current/userguide/command_line_interface.html#common_tasks
中对于--scan的解释是
--scan
Create a build scan with fine-grained information about all aspects of your Gradle build.
网友评论