Finally, I figured out this problem. This was due to some 9 patch icons that I used in my project resources. I used some third-party tools to draw these icons. Now I have replaced these icons with the same one created using Android studio (
see how ), and everything works for me.
Also, if you do not want to use AAPT2. You can disable the android.enableAapt2=false setting in your gradle.properties file as suggested by @ capt.swag
source share