以下是我的Gradle文件。它在棉花糖上工作但它不适用于KitKat 4.2.2。当我在Kitkat上运行它时,它返回以下错误。
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不支持App。如果我使用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 :(得分:1)
通过添加以下内容,我可以正常使用
aaptOptions { additionalParameters“--no-version-vectors” } 强>
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'