Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 添加支持:preference-v7或-v14库导致Gradle构建失败_Android_Android Support Library_Android Preference V14 - Fatal编程技术网

Android 添加支持:preference-v7或-v14库导致Gradle构建失败

Android 添加支持:preference-v7或-v14库导致Gradle构建失败,android,android-support-library,android-preference-v14,Android,Android Support Library,Android Preference V14,我的项目构建得很好,直到我尝试包含支持首选项库 当我这样做时,生成失败并出现以下错误: C:\Users\user\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.0.aar\e8afe3ff4b4dc10495266439a3695e57\res\values\values.xml:252:5-69: AAPT: error: duplicate value for resource 'attr/min' with config

我的项目构建得很好,直到我尝试包含支持首选项库

当我这样做时,生成失败并出现以下错误:

C:\Users\user\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.0.aar\e8afe3ff4b4dc10495266439a3695e57\res\values\values.xml:252:5-69: AAPT: error: duplicate value for resource 'attr/min' with config ''.

C:\Users\user\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.0.aar\e8afe3ff4b4dc10495266439a3695e57\res\values\values.xml:252:5-69: AAPT: error: resource previously defined here.

C:\Users\user\StudioProjects\project\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:627: error: duplicate value for resource 'attr/min' with config ''.

C:\Users\user\StudioProjects\project\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:483: error: resource previously defined here.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
我真的不知道为什么会发生这个错误

编辑:Full build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
    compileSdkVersion 27

    compileOptions { 
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.myapp"
        minSdkVersion 16
        targetSdkVersion 27
        multiDexEnabled true
        versionCode 1
        versionName "myVersion" 
        resConfigs "en"
    }

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

        debug {
            ext.enableCrashlytics = false
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')

    def firebaseVersion = '11.4.2'
    def supportVersion = '27.0.0'

    //Firebase Crashlytics
    compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
        transitive = true
    }

    //Firebase
    implementation 'com.google.firebase:firebase-auth:' + firebaseVersion
    implementation 'com.google.firebase:firebase-core:' + firebaseVersion
    implementation 'com.google.firebase:firebase-firestore:' + firebaseVersion

    //FirebaseUI
    implementation 'com.firebaseui:firebase-ui-auth:3.1.0'

    //Android Support
    implementation 'com.android.support:support-v4:' + supportVersion

    implementation 'com.android.support:appcompat-v7:' + supportVersion
    implementation 'com.android.support:cardview-v7:' + supportVersion
    implementation 'com.android.support:gridlayout-v7:' + supportVersion
    implementation 'com.android.support:recyclerview-v7:' + supportVersion
    implementation 'com.android.support:preference-v7:' + supportVersion

    implementation 'com.android.support:preference-v14:' + supportVersion 

    implementation 'com.android.support:support-vector-drawable:' + supportVersion

    implementation 'com.android.support:design:' + supportVersion

    implementation 'com.android.support.constraint:constraint-layout:1.0.2'

    implementation 'com.android.support:multidex:1.0.2'

    //Material About
    implementation 'com.github.daniel-stoneuk:material-about-library:2.2.3-support26.1.0' //Weird version system

    //OpenCSV
    implementation('com.opencsv:opencsv:4.0') {
        //Transitively requires Apache Commons, which necessitates multidex...
        exclude group: 'commons-beanutils'
    }

    //Gson
    implementation 'com.google.code.gson:gson:2.8.2'
}

apply plugin: 'com.google.gms.google-services'
它需要更多的细节,所以我将详细说明这个问题。
我想使用AppCompat首选项库,但每当我尝试将其添加到build.gradle时,开头的错误就会弹出

您可以转到文件->使缓存无效/重新启动。这将使你的项目中任何错误的东西无效。。让我知道它是否有用

您可以转到文件->使缓存无效/重新启动。这将使你的项目中任何错误的东西无效。。让我知道它是否有用

您可以尝试使用以下内容从关于库的材料中排除支持库:

  implementation ('com.github.daniel-stoneuk:material-about-library:2.2.3-support26.1.0') {
    exclude group: 'com.android.support'
    exclude module: 'appcompat-v7'
    exclude module: 'cardview-v7'
    exclude module: 'design'
  }

请查看其build.gradle:

您可以尝试使用以下内容从有关库的资料中排除支持库:

  implementation ('com.github.daniel-stoneuk:material-about-library:2.2.3-support26.1.0') {
    exclude group: 'com.android.support'
    exclude module: 'appcompat-v7'
    exclude module: 'cardview-v7'
    exclude module: 'design'
  }

请查看其build.gradle:

显然,问题是由my attrs.xml中的id引起的:

<resources>
    <declare-styleable name="MyView">
        <attr name="min" format="float" />
    </declare-styleable>
</resources>


我通过将
min
更改为
minValue
修复了此错误

显然,问题是由my attrs.xml中的id引起的:

<resources>
    <declare-styleable name="MyView">
        <attr name="min" format="float" />
    </declare-styleable>
</resources>


我通过将
min
更改为
minValue
修复了此错误

您的gradle显示您的gradle共享您的应用程序gradle以便我们可以帮助您添加依赖项gradle显示您的gradle共享您的应用程序gradle以便我们可以帮助您添加依赖项此问题没有解决:(能否附加build.gradle文件。请确保您的编译器DKVersion和TargetSDKVVersion彼此匹配,并且版本匹配。我添加了完整的build.gradle。此操作无法解决此问题。:(能否附加build.gradle文件。请确保您的compileSdkVersion和targetSdkVersion彼此匹配版本匹配。我添加了完整build.gradle