属性“”已使用不兼容的格式定义

时间:2016-11-11 14:35:19

标签: android gradle android-xml android-appcompat android-support-design

这是我的build.gradle代码

apply plugin: 'com.android.application'
repositories {
maven { url System.getenv('ANDROID_HOME') + '/extras/android/m2repository' }
maven { url System.getenv('ANDROID_HOME') + '/extras/google/m2repository' }
maven { url 'https://github.com/friberry/mvn-repo/raw/master/' }
maven { url "http://jzaccone.github.io/SlidingMenu-aar" }
// for htmlspanner
maven { url 'http://repo.pageturner-reader.org' }
// for facebook sdk
maven { url "http://mente.github.io/facebook-api-android-aar" }
// for kakao sdk
maven { url 'http://devrepo.kakao.com:8088/nexus/content/groups/public/' }
mavenCentral()
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.android.gcm:gcm-client:1.0.2'
compile 'com.google.android.gms:play-services:7.0.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.jeremyfeinstein.slidingmenu:library:1.3@aar'
compile 'com.squareup.dagger:dagger:1.0.1'
compile 'com.squareup.dagger:dagger-compiler:1.0.1'
compile 'com.jakewharton:butterknife:4.0.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.8.6'
compile 'net.nightwhistler.htmlspanner:htmlspanner:0.4'
compile 'com.github.kevinsawicki:http-request:5.4.1'
compile 'com.friberry.viewpagerindicator:library:2.4.1'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.kevinsawicki:wishlist:0.9'
compile 'com.squareup:otto:1.3.4'
compile 'com.squareup.retrofit:retrofit:1.1.1'
compile 'com.squareup.okhttp:okhttp:1.2.1'
compile 'ch.acra:acra:4.5.0'
compile 'org.jsoup:jsoup:1.7.3'
compile 'org.apache.commons:commons-lang3:3.1'
compile 'org.apache.maven:maven-artifact:3.0.5'
compile 'joda-time:joda-time:2.3'
compile 'com.github.chrisbanes.actionbarpulltorefresh:extra-abs:0.8'
compile 'com.j256.ormlite:ormlite-android:4.47'
compile 'com.j256.ormlite:ormlite-core:4.47'
compile 'com.facebook:facebook-android-sdk:3.5.2@aar'
compile 'com.kakao.sdk:kakaolink:1.0.44'
compile files('libs/apsalar-6.0.0.jar')
androidTestCompile 'junit:junit:4.11'
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
androidTestCompile 'org.mockito:mockito-core:1.9.5'
}

archivesBaseName = 'com-friberry-app-fbshop'

android {
compileSdkVersion 24
buildToolsVersion '24.0.2'

defaultConfig {
    applicationId "com.byteshaft.fbshop"
    minSdkVersion 16
    targetSdkVersion 24
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src/main/java']
        resources.srcDirs = ['src/main/java']
        aidl.srcDirs = ['src/main/java']
        renderscript.srcDirs = ['src/main/java']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

    //instrumentTest.setRoot('src/test/java')
}

signingConfigs {
    release {
        storeFile file('keystore')
        keyAlias 'friberry'
        // These two lines make gradle believe that the signingConfigs section is complete. Without them, tasks like installRelease will not be available!
        storePassword "mad2dev_0815"
        keyPassword "mad2dev_0815"
    }
}

buildTypes {
    debug {
        // packageNameSuffix '.debug'
        minifyEnabled false
        debuggable true
        zipAlignEnabled false
    }
    release {
        minifyEnabled true
        debuggable false
        proguardFile '../proguard.cfg'
        signingConfig signingConfigs.release
        zipAlignEnabled true
        // testPackageName 'com.friberry.app.FBShop.tests'
        // testInstrumentationRunner 'android.test.InstrumentationTestRunner' // this is the default
    }
}

// To handle the following error: Error: duplicate files during packaging of APK
packagingOptions {
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/services/javax.annotation.processing.Processor'
}

aaptOptions {
    noCompress 'txt'
    ignoreAssetsPattern "!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini"
}

lintOptions {
    quiet true
    abortOnError false
    ignoreWarnings false
    checkAllWarnings true
    disable 'SpUsage', 'ContentDescription', 'ExportedReceiver', 'ExportedContentProvider', 'UselessParent', 'TypographyDashes', 'TypographyQuotes', 'RtlSymmetry', 'IconDuplicates', 'IconDensities', 'IconColors', 'NestedWeights', 'SetJavaScriptEnabled'
    htmlReport true
}
}

task askForPasswords {
// Must create String because System.readPassword() returns char[] (and assigning that below fails silently)
def keyStorePw = System.getenv('FRIBERRY_KEYSTORE_PASSWORD')
if (!keyStorePw?.trim() && System.console()) {
    keyStorePw = new String(System.console().readPassword("\n\$ Enter keyStore password: "))
}

android.signingConfigs.release.storePassword = keyStorePw
android.signingConfigs.release.keyPassword = keyStorePw
}
tasks.whenTaskAdded { theTask ->
if (theTask.name.equals("packageRelease")) {
    theTask.dependsOn "askForPasswords"
}
}

代码在api 20上运行正常,我将它更新到最新版本但是当我使用构建工具编译它时我遇到了问题

我收到此错误

Error:(206) Attribute "background" already defined with incompatible format.
Error:(8) Original attribute defined here.
Error:(449) Attribute "navigationMode" already defined with incompatible format.
Error:(193) Original attribute defined here.
Error:(457) Attribute "displayOptions" already defined with incompatible format.
Error:(199) Original attribute defined here.
Error:(470) Attribute "itemBackground" already defined with incompatible format.
Error:(441) Original attribute defined here.
Error:(473) Attribute "actionBarSize" already defined with incompatible format.
Error:(250) Original attribute defined here.
Error:(475) Attribute "windowMinWidthMajor" already defined with incompatible format.
Error:(249) Original attribute defined here.

代码是使用'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'在依赖项中编译但在我读到“删除它后使用appcompat所以我删除它”但我仍然是得到这些错误我不知道哪个库导致它。 有人帮助我。 这是生成的values.xml value.xml

1 个答案:

答案 0 :(得分:0)

我有一个类似的问题,我自己的一个自定义控件有一个名为min的属性,格式为=" float"。 Seekbar还使用属性min,格式为="整数"。

最后,我将我的属性重命名为minValue,以避免冲突。对我来说,这看起来像Android中的一个错误,因为属性名称不应该在它们自己的declare-stylable资源中定义时发生冲突。当我将我的android插件更新为25.1.0

时,今天出现了这个问题