在低版本里爲了引入android material所遇到的問題

在低版本里爲了引入android material 只要將gradle作以下修改java

 

targetSdkVersion 21

改爲你目前的版本就能夠,此時編譯通常都沒問題,app運行若是有異常並報:android

07-26 14:23:27.882: E/AndroidRuntime(8517): Java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.rx/com.test.rx.MainActivity}: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.

07-26 14:23:27.882: E/AndroidRuntime(8517): Caused by: java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat.
07-26 14:23:27.882: E/AndroidRuntime(8517):   atAndroid.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.javapp

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

解決方法:ui

 

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

  1. dependencies {  
  2.         classpath 'com.android.tools.build:gradle:2.0.0'  
  3.   
  4.         // NOTE: Do not place your application dependencies here; they belong  
  5.         // in the individual module build.gradle files  
  6.     }  

2.此時控制檯輸出異常:Warning:Gradle version 2.10 is required. Current version is 2.8. If using the gradle wrapper, try editing the distributionUrl in E:\RX\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip.net

按照路徑所指出的地址,找到文件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.zipip

從新運行並安裝就能夠了ci

相關文章
相關標籤/搜索