{"kind":"error","text":"error: resource android:attr/colorError not found."
{"kind":"error","text":"error: resource android:attr/font not found."
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Failed to process resources, see aapt output above for details.
報各種資源找不到的錯!!!
原因是
compileSdkVersion 25
低於
implementation 'com.android.support:appcompat-v7:27.0.0'
sdk編譯版本低於support包的版本一般就會報這個錯,當然並不是絕對的,一般是高版本的support包中的資源文件在底版本sdk中找不到的時候才會報錯。
比如你compileSdkVerion 26,support版本用27.0.0的時候就不會報錯。
但是如果你打開app下的build.gradle發現上述兩個版本號一致,怎么也報錯了,那你這個工程中肯定還有其他module,在其他module中引用了比主app中compileSdkVerion高的support包了
Studio在打包的時候會檢測所有module中的support包,對於不同版本的情況,最終取最高版本的support包來為所有module進行編譯。
原因知道了,解決辦法就簡單了,要么升sdk版本,要么降support版本。