This app has been built with an incorrect configuration

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。


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