资源'attr / layout_anchorGravity'与配置''的重复值。在部署应用程序时

时间:2019-04-11 06:12:30

标签: android android-gradle build.gradle

由于此错误,我无法在手机上部署Android:

Android resource compilation failed
Output:  /home/corentin/projets/joiedurythme/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:1126: error: duplicate value for resource 'attr/layout_anchorGravity' with config ''.
/home/corentin/projets/joiedurythme/app/build/intermediate/incremental/mergeDebugResources/merged.dir/values/values.xml:1126: error: resource previously defined here.

Command: /home/corentin/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-linux.jar/aa1ab9897b0a951baf8af326489fabe4/aapt2-3.2.1-4818971-linux/aapt2 compile --legacy \
    -o \
    /home/corentin/projets/joiedurythme/app/build/intermediates/res/merged/debug \
    /home/corentin/projets/joiedurythme/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Daemon:  AAPT2 aapt2-3.2.1-4818971-linux Daemon #1

我已经尝试过更改应用程序兼容性库的版本,但无济于事...

我的项目结构是:

joiedurythme

  • joiedurythme(根)
  • 应用程序(我的主要项目)
  • opencv(我正在尝试安装)
  • perfo(仅当我需要aop时使用)

我的应用程序build.gradle文件是:

import org.aspectj.bridge.IMessage
import org.aspectj.bridge.MessageHandler
import org.aspectj.tools.ajc.Main

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {

        //TEst en supprimanf
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'org.aspectj:aspectjtools:1.8.1'
    }
}

apply plugin: 'com.android.application'
//apply plugin: 'com.android.library'

repositories {
    mavenCentral()
}
dependencies {
    // Decommenter pour performances
    //implementation project(':perfo')
    implementation project(':opencv')
    implementation 'org.aspectj:aspectjrt:1.8.1'
}

// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
        'main',     // main sample code; look here for the interesting stuff.
        'common',   // components that are reused by multiple samples
        'template'] // boilerplate code that is generated by the sample template process

android {
    compileSdkVersion 22
    buildToolsVersion '22.0.3'
    defaultConfig {
        applicationId "com.joiedurythme"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    lintOptions {
        abortOnError false
    }
    sourceSets {
        main {
            dirs.each { dir ->
                java.srcDirs "src/${dir}/java"
                res.srcDirs "src/${dir}/res"
            }
        }
        androidTest.setRoot('tests')
        androidTest.java.srcDirs = ['tests/src']

    }
}

dependencies {

    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    //https://stackoverflow.com/questions/31358724/sync-shared-library-projects-modules-with-its-source/31524641#31524641
    //implementation project(path:':opencv', configuration: 'default')
    //https://stackoverflow.com/questions/39663720/android-studio-errorunable-to-load-class-org-slf4j-loggerfactory
    implementation project(':opencv')
    //implementation 'org.slf4j:slf4j-api:1.8.0-beta4'

    implementation 'com.android.support:appcompat-v7:22.+'
    //implementation 'com.android.support:appcompat-v7:22.+'
    implementation 'com.android.support:design:22.+'
    implementation 'com.android.support.constraint:constraint-layout:+'

    //implementation 'com.android.support:support-v4:22.+'
    implementation 'com.googlecode.mp4parser:isoparser:1.1.9'
    implementation 'jp.co.cyberagent.android:gpuimage:2.0.3'
    implementation 'commons-io:commons-io:2.6'
    implementation 'com.google.android.gms:play-services-vision:9.4.0+'

    testCompile 'junit:junit:4.12'
    compile project(path: ':opencv')
}

final def log = project.logger
final def variants = project.android.applicationVariants

variants.all { variant ->
    if (!variant.buildType.isDebuggable()) {
        log.debug("Skipping non-debuggable build type '${variant.buildType.name}'.")
        return;
    }

    JavaCompile javaCompile = variant.javaCompile
    javaCompile.doLast {
        String[] args = [//"-showWeaveInfo",
                         "-1.5",
                         "-inpath", javaCompile.destinationDir.toString(),
       //                  "-aspectpath", javaCompile.classpath.asPath,
                         "-d", javaCompile.destinationDir.toString(),
                         "-classpath", javaCompile.classpath.asPath,
                         "-bootclasspath", project.android.bootClasspath.join(File.pathSeparator)]
        log.debug "ajc args: " + Arrays.toString(args)

        MessageHandler handler = new MessageHandler(true);
        new Main().run(args, handler);
        for (IMessage message : handler.getMessages(null, true)) {
            switch (message.getKind()) {
                case IMessage.ABORT:
                case IMessage.ERROR:
                case IMessage.FAIL:
                    log.error message.message, message.thrown
                    break;
                case IMessage.WARNING:
                    log.warn message.message, message.thrown
                    break;
                case IMessage.INFO:
                    log.info message.message, message.thrown
                    break;
                case IMessage.DEBUG:
                    log.debug message.message, message.thrown
                    break;
            }
        }
    }
}

我正在将intelliJ与android sdk 22配合使用。

0 个答案:

没有答案