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

标签 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上运行正常,我将其更新为最新版本,但是在使用构建工具24进行编译时遇到了问题

我收到此错误
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

最佳答案

我自己的自定义控件之一也遇到了类似的问题,该控件的属性名为min,格式为“float”。 Seekbar还使用格式为min =“integer”的min属性。

最后,为了避免冲突,我将属性重命名为minValue。在我看来,这似乎是Android中的错误,因为如果属性名称是在自己的可声明样式资源中定义的,则属性名称不应冲突。今天,当我将我的android插件更新为25.1.0时,这个问题就出现了

关于android - 属性 “”已使用不兼容的格式定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40550219/

相关文章:

android - 加载均匀矩阵 1104 GL_Invalid_Operation Android OpenGLES 2.0

android - 由 Subjects 组成的 Observable transformer

android - 我想从 Assets 文件夹设置推送通知声音,Android

android - 如何调试 Gradle 同步失败,没有其他信息?

Gradle : how can I call a 'def' from an imported script?

android - 使用引用 Color 的字符串设置 textColor 时出错

android - 我可以更改图像边框的默认颜色吗?

android - Android Studio build.gradle 文件报错 Can't apply main & dependencies

android - 如何在 Android Studio Bumblebee 中添加项目级依赖类路径

android - 如何在样式中引用颜色属性