解决一个不能定位具体行数的编译问题

225 阅读1分钟

解决了一个运行时没有问题,编译release版本时遇到编译失败,但是没有明确编译错误位置的问题,希望大家遇到有所帮助

编译错误日志

> Task :app:minifyReleaseWithR8 FAILED

ERROR:/Volumes/Builds/builds/NS6ct_TY/0/giantart/art-android/app/build/intermediates/aapt_proguard_file/release/aapt_rules.txt:998:33: R8: Expected field or method name at /Volumes/Builds/builds/NS6ct_TY/0/giantart/art-android/app/build/intermediates/aapt_proguard_file/release/aapt_rules.txt:998:33

keepclassmembers class * { *** @{onClickListener}(android.view.View); }



问题原因

原因是在xml中加入了

android:onClick="@{onClickListener}"

但是onClickListener变量没有在xml中定义。应该是开发的同学粘贴复制过来的。

删除这种代码即可。 这种问题,在大量的代码提交以后,最后release发现有问题还是比较难定位的。 不过如果知道什么原因引入的还是比较好处理的。