Android gradle問題解決: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat


1. 問題描述:

Android Studio在運行模擬器某些機型或者真機某些機型的時候發生閃退。

錯誤如下:

Java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx.MainActivity}: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.

產生的原因是:com.android.support:appcompat-v7與rasterized vectors不兼容,gradle2.0及其之上,library的資源沒有柵格化,所以不會發生這個問題

 

2. 解決方案:

1.在projectgradle中將gradle版本改為2.0或者之上

 

 

2. 再次運行,此時控制台輸出異常:Warning:Gradle version 2.10 is required. Current version is 2.8. If using the gradle wrapper, try editing the distributionUrl in xxx\bbb\gradle-wrapper.properties to gradle-2.10-all.zip

 

按照路徑所指出的地址,找到文件gradle-wrapper.properties,編輯最后一句版本號為日志中所輸出的版本

 

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

 

3. 再次運行,還是錯誤,原因是你還沒有下載gradle-2.10

這時可以從網上下載一個gradle-2.10.zip並解壓,然后放到AndroidStudiodd的默認gradle配置目錄

然后再在AndroidStudio中做一下設置,如下圖

 

 

最后再運行IDE, Ok一切搞定!!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM