pom.xml中的重复文件

时间:2017-04-04 19:35:36

标签: android-studio

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK pom.xml
    File1: /Users/michaelnares/Documents/TripMatcher2/app/libs/library_sliding.jar
    File2: /Users/michaelnares/Documents/TripMatcher2/app/libs/roundedimageview.jar

有没有办法在Android Studio中查看pom.xml?我只能看到build.gradle。我的顶级build.gradle如下:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
        classpath 'com.google.gms:google-services:3.0.0'

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

allprojects {
    repositories {
        jcenter()
    }
}

我的app级build.gradle如下:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.tripmatcher"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.google.android.gms:play-services-auth:9.2.1'

    // glide is added to load the g+ profile image. Ignore if you want
    compile 'com.github.bumptech.glide:glide:3.7.0'

    compile fileTree(include: ['*.jar'], dir: 'libs')

    apply plugin: 'com.google.gms.google-services'

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile files('libs/facebook_sdk.jar')
    compile files('libs/android-support-v4.jar')
}

据我所见,一切都应该可以正常工作。

2 个答案:

答案 0 :(得分:0)

我们在使用pom.xml的Android项目中没有Android Studio,项目的所有依赖项都在build.gradle文件中。以下问题是因为您需要指定要使用的Google服务库。喜欢:

   compile "com.google.android.gms:play-services-maps:10.2.1"

答案 1 :(得分:0)

对于遇到此问题的任何其他人,从Eclipse项目手动删除pom.xml文件,然后创建.jar之后就可以了。