Androidのリソースのコンパイルに失敗しました

mdadil2019:

私は、私が追加した場合ので、私は設計支援ライブラリを必要としていますAndroidアプリ開発していますimplementation 'com.android.support:design:27.1.1'私のbuild.gradle(アプリ)に、次のエラーが表示されますが:

org.gradle.internal.UncheckedException:によって引き起こさjava.util.concurrent.ExecutionException:com.android.builder.internal.aapt.v2.Aapt2Exception:Androidのリソースのコンパイル失敗MyAppDirectory \アプリ\ビルド\中間体\増分\ mergeDebugResources \合併.DIR \値\ values.xml:2489:エラー:リソースの重複する値 'のattr / itemBackground' と設定 ''。

しかし、私は、依存関係を削除するとimplementation 'com.android.support:design:27.1.1'、エラーが消え、Gradleのビルドに成功。

私のプロジェクトのbuild.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
    google()
    jcenter()
}
dependencies {
  //        classpath 'com.android.tools.build:gradle:3.1.3'
    classpath 'com.android.tools.build:gradle:3.3.0-alpha04'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
     }
 }

allprojects {
repositories {
    google()
    jcenter()


   }
}

task clean(type: Delete) {
delete rootProject.buildDir
}

マイアプリのbuild.gradle

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
    applicationId "myapplicationid"
    minSdkVersion 16
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
   }
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'

implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

//third party libraries
implementation 'com.hbb20:ccp:2.2.2'

implementation 'info.hoang8f:fbutton:1.0.5'
implementation 'com.chaos.view:pinview:1.4.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
}

注:私はすでに洗浄し、プロジェクトをrebuilded私も無効にしているとキャッシュをクリアしています

混沌 :

いくつかの研究を行うことで、私はMenuView(ツールバーのメニュー)は、この属性を定義していることがわかりました。

<declare-styleable name="MenuView">
    ...
    <!-- Default background for each menu item. -->
    <attr name="itemBackground" format="color|reference" />
    ...
</declare-styleable>

私が使用している<attr name="android:itemBackground" />代わりに<attr name="itemBackground" format="reference|color" />、この問題を解決します。

バージョン1.4.1にアップグレードしてください。

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=210168&siteId=1