Android问题集锦(十四)- The option 'android.enableAapt2' is deprecated and should not be used anymore.

今天在升级到Android studio3.1后,编译运行程序报以下异常:

在Java compiler已经有很明显的警告提示了:

The option 'android.enableAapt2' is deprecated and should not be used anymore. Use 'android.enableAapt2=true' to remove this warning. It will be removed at the end of 2018..

意思就说android.enableAapt2已经被弃用了,不能被使用了。可以使用android.enableAapt2=true去除该警告,再clear build重新运行程序即可。

参考: