2017-10-26 32 views
29
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 /media/nikhilesh/App/src/main/res/drawable/ic_add_black_24dp.xml : Can't process attribute android:fillColor="@color/green": 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. 

Làm cách nào để chúng tôi có thể giải quyết vấn đề này?Cập nhật Android Studio thành 3.0 và nhận được sự cố này

+0

Hãy thử làm sạch dự án và rebuildit –

Trả lời

56

Bạn có thể thêm dòng sau bên trong cấu hình mặc định của bạn ứng dụng build.gradle của bạn:

defaultConfig{ 
    vectorDrawables.useSupportLibrary = true 
} 

Edit: bạn cũng cần thêm sự phụ thuộc này nếu bạn đã làm chưa

dependencies { 
    compile 'com.android.support:appcompat-v7:26.1.0' 
} 
8

Vấn đề là vì gradle mới không thể tham chiếu đến thư viện màu mà bạn sử dụng để lấy giá trị @ color/green.

Giải pháp là giống như rotemitz nói Chỉ cần thêm dòng này vào defaultConfig lại build.gradle (Học phần: ứng dụng)

vectorDrawables.useSupportLibrary = true 

AND để phụ thuộc của build.gradle cùng

compile 'com.android.support:appcompat-v7:23.1.0' 

Lưu ý: Bạn có thể thay đổi phiên bản appcompat, tham khảo phiên bản SDK biên dịch của bạn

5

Bạn chỉ cần thêm dòng sau bên trong cấu hình mặc định của bạn của bạn ứng dụng build.gradle:

defaultConfig{ 
     vectorDrawables.useSupportLibrary = true 
    } 
Các vấn đề liên quan