2016-12-22 18 views
0

以下是我的Gradle文件。它在棉花糖上工作,但它不適用於KitKat 4.2.2。它在Kitkat上運行時會返回以下錯誤。E/VdcInflateDelegate:org.xmlpull.v1.XmlPullParserException:二進制XML文件行#17 <vector> tag requires viewportWidth> 0

Exception while inflating <vector> 
12-21 17:45:46.235 12303-12303/com.xyz.packagename E/VdcInflateDelegate: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0 

AppCompact不支持該應用程序。如果我使用Activity而不是Appcompact,那麼它工作正常,但我需要使用AppCompact,因爲Material Design Things的集成。

apply plugin: 'com.android.application' 

android 
    { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 


    defaultConfig 
    { 
     applicationId "com.xyz.projectName" 
     minSdkVersion 16 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled true 
    } 
    buildTypes 
    { 
     release 
     { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

dependencies 

{ 

    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    // multidex 
    compile 'com.android.support:multidex:1.0.0' 


    compile 'com.android.support:appcompat-v7:25.1.0' 
    compile 'com.android.support:design:25.1.0' 
    compile 'com.android.support:recyclerview-v7:25.1.0' 


    // Map 
    //compile 'com.google.android.gms:play-services:10.0.1' 
    compile 'com.google.android.gms:play-services-maps:10.0.1' 
    compile 'com.google.maps.android:android-maps-utils:0.3+' 


    //Firebase 
    compile 'com.google.firebase:firebase-messaging:10.0.1' 
    compile 'com.google.firebase:firebase-core:10.0.1' 



} 
apply plugin: 'com.google.gms.google-services' 

請幫忙。

+0

變化'buildToolsVersion 「25.0.2」 '這個'buildToolsVersion「25.1.0」'。 – Ironman

+0

[更新Android支持庫到23.2.0的可能的重複錯誤:XmlPullParserException二進制XML文件行#17 標記需要viewportWidth> 0](http://stackoverflow.com/questions/35622438/update-android-support-library -to-23-2-0-cause-error-xmlpullparserexception-bin) –

+0

我已經嘗試了@IronMan和@ Saeed Zhiany給出的兩種解決方案,但仍然出現同樣的錯誤。 –

回答

1

通過添加以下行它的工作對我罰款

aaptOptions { additionalParameters 「--no版本向量」 }

apply plugin: 'com.android.application' 

    android { 
     compileSdkVersion 25 
     buildToolsVersion "25.0.2" 


     defaultConfig { 
      applicationId "com.xyz.project name" 
      minSdkVersion 16 
      targetSdkVersion 25 
      versionCode 1 
      versionName "1.0" 
     /* vectorDrawables.useSupportLibrary = true 
      generatedDensities = []*/ 
      multiDexEnabled true 
     } 
     buildTypes { 
      release { 
       minifyEnabled false 
       proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
      } 
     } 

     // important to run code on kitkat 

     aaptOptions { 
      additionalParameters "--no-version-vectors" 
     } 
    } 

    dependencies { 
     compile fileTree(dir: 'libs', include: ['*.jar']) 
     testCompile 'junit:junit:4.12' 
     // multidex 
     compile 'com.android.support:multidex:1.0.0' 


     compile 'com.android.support:appcompat-v7:25.1.0' 
     compile 'com.android.support:design:25.1.0' 
     compile 'com.android.support:recyclerview-v7:25.1.0' 

     // ImageLoader 
     compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5' 

     // Map 
     //compile 'com.google.android.gms:play-services:10.0.1' 
     compile 'com.google.android.gms:play-services-maps:10.0.1' 
     compile 'com.google.maps.android:android-maps-utils:0.3+' 

     // Spinner 
     compile 'com.jaredrummler:material-spinner:1.1.0' 

     // Volley 
     compile 'com.android.volley:volley:1.0.0' 

     //Firebase 
     compile 'com.google.firebase:firebase-messaging:10.0.1' 
     compile 'com.google.firebase:firebase-core:10.0.1' 

     //CropImage 
     compile project(':CropImage') 

    } 
    apply plugin: 'com.google.gms.google-services' 
相關問題