references to other resources are not supported by build-time PNG generation

導入第三方代碼,出現如下異常:

Error:Execution failed for task ':app:mergeDebugResources'.
> There were multiple failures while executing work items
   > A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
      > Error while processing D:\dmeoProject\Rfideam\app\src\main\res\drawable\ic_vector_check.xml : Can't process attribute android:fillColor="@color/ip_color_accent": references to other resources are not supported by build-time PNG generation. See http://developer.android.com/tools/help/vector-asset-studio.html for details.
   > A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
      > Error while processing D:\dmeoProject\Rfideam\app\src\main\res\drawable\ic_vector_check.xml : Can't process attribute android:fillColor="@color/ip_color_accent": references to other resources are not supported by build-time PNG generation. See http://developer.android.com/tools/help/vector-asset-studio.html for details.
   > A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
      > Error while processing D:\dmeoProject\Rfideam\app\src\main\res\drawable\ic_vector_check.xml : Can't process attribute android:fillColor="@color/ip_color_accent": references to other resources are not supported by build-time PNG generation. See http://developer.android.com/tools/help/vector-asset-studio.html for details.
   > A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
      > Error while processing D:\dmeoProject\Rfideam\app\src\main\res\drawable\ic_vector_check.xml : Can't process attribute android:fillColor="@color/ip_color_accent": references to other resources are not supported by build-time PNG generation. See http://developer.android.com/tools/help/vector-asset-studio.html for details.
   > A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
      > Error while processing D:\dmeoProject\Rfideam\app\src\main\res\drawable\ic_vector_check.xml : Can't process attribute android:fillColor="@color/ip_color_accent": references to other resources are not supported by build-time PNG generation. See http://developer.android.com/tools/help/vector-asset-studio.html for details.
   > A failure occurred while executing com.android.build.gradle.tasks.MergeResources$FileGenerationWorkAction
      > Error while processing D:\dmeoProject\Rfideam\app\src\main\res\drawable\ic_vector_check.xml : Can't process attribute android:fillColor="@color/ip_color_accent": references to other resources are not supported by build-time PNG generation. See http://developer.android.com/tools/help/vector-asset-studio.html for details.

查看異常文件ic_vector_check,使用了vector標籤,是矢量圖,屬於vectorDrawables資源。需要在工程-app的build.gradle的defaultConfig中添加vectorDrawables.useSupportLibrary = true就可以了。

 

關於Android矢量圖,參考Android矢量圖(一)--VectorDrawable基礎

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章