3

I use android studio 2.0 version. I use the gradle to build the program, take this the question: enter image description here

I know this question in the Android studio 0.7version have the same question. I see the Link Duplicate files copied (Android Studio 0.4.0)

But, I follow this way: enter image description here

But this method it doesn't work for me!

Could you help me? I am waiting for you!

Community
  • 1
  • 1
GeekHades
  • 3,028
  • 3
  • 19
  • 15
  • update your gradle file – curiousMind Nov 27 '15 at 07:06
  • @Ashvi thank you , But not this question. I know this quesetion is the andorid studio 2.0 question. So i download the android studio 1.4 version, run the progrom ,It is OK ! Just because the Android studio 2.0 inner quesetion! – GeekHades Nov 28 '15 at 03:42
  • I am having the same problem but it is happening with every maven file. Right now I have exclude statements for a dozen files. That doesn't seem right. – androidtitan Sep 07 '16 at 00:04

2 Answers2

15

I came across the same issue and found the duplicate file is nothing to do with AndroidStudio 2.0 preview, maybe it's cause by gradle. please try following:

packagingOptions {
    exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.xml'
    exclude 'META-INF/maven/com.belerweb/pinyin4j/pom.properties'
}

if you have resovled the duplicate issue but come across the ClassNotFoundIssue please refre to this topic.

Weibo
  • 1,042
  • 8
  • 18
1

Add below text on build.gradle file solve problem

packagingOptions {
   exclude  'META-INF/maven/com.belerweb/pinyin4j/pom.properties'
}

If getting more error DuplicateFileException add file with exclude. Like :

Error

 Duplicate files copied in APK META-INF/maven/com.belerweb/pinyin4j/pom.properties

Solution

 exclude  'META-INF/maven/com.belerweb/pinyin4j/pom.properties'
Lokesh Patel
  • 1,122
  • 8
  • 14