2017-04-04 37 views
0
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如下:pom.xml中的重複文件

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() 
    } 
} 

我的應用程序級的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') 
} 

據我所看到的,一切都應該正常工作。

+0

沒有pom.xml,你只能看到build.gradle –

+0

行,請問有沒有另外一種方法可以解決這個問題? –

+0

有沒有人找出如何解決這個問題? – DroidDev

回答

0

我們沒有pom.xml在Android項目中使用Android Studio,項目的所有依賴項都在build.gradle文件中。下面的問題是因爲您需要指定要使用的Google服務的庫。像:

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

查看更新的問題。我已將這些包含在我的應用程序級build.gradle中。 –

+0

有其他解決方法嗎? –

0

對於任何人遇到此問題,手動從Eclipse項目中刪除pom.xml文件,然後創建.jar之後爲我做了詭計。