user5710675
user5710675

Reputation:

Import project from eclipse to android studio getting error

I am new to Android Studio, I just import a project in Android Studio which was run in Eclipse. Few of error are resolved but this is not solved yet.

Here is error -

Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'. com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/LICENSE.txt File1: /home/user86/Downloads/IAH/app/libs/httpmime-4.2.3.jar File2: /home/user86/Downloads/IAH/app/libs/httpclient-4.2.3.jar File3: /home/user86/Downloads/IAH/app/libs/httpcore-4.2.2.jar

And here is build.gradle file code.

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.packagename"
    minSdkVersion 14
    targetSdkVersion 23
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
}}


dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.android.gms:play-services:+'
compile files('libs/Parse-1.4.0.jar')
compile files('libs/httpclient-4.2.3.jar')
compile files('libs/httpcore-4.2.2.jar')
compile files('libs/httpmime-4.2.3.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/volley.jar')
}

Help to resolve it. Thanks in advance.

Updated gradle file

apply plugin: 'com.android.application'


dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.android.gms:play-services:+'
compile files('libs/Parse-1.4.0.jar')
compile files('libs/httpclient-4.2.3.jar')
compile files('libs/httpcore-4.2.2.jar')
compile files('libs/httpmime-4.2.3.jar')
compile files('libs/picasso-2.5.2.jar')
compile files('libs/volley.jar')}



android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.instantassignmenthelp"
    minSdkVersion 14
    targetSdkVersion 23
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
}}


packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'}

Upvotes: 0

Views: 211

Answers (3)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75778

  1. Problem for your packagingOptions Tag

Advice

Avoid calling +.

Don't

compile 'com.google.android.gms:play-services:+'

Do

compile 'com.google.android.gms:play-services:7.8.0' // Or latest stable version

Finally

 buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
}


packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'

}
}

Upvotes: 1

Raghavendra
Raghavendra

Reputation: 2303

The packageOptions should come inside android tag.

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "com.instantassignmenthelp"
    minSdkVersion 14
    targetSdkVersion 23
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
    }
}




 packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
    }
}

Upvotes: 0

Amit Vaghela
Amit Vaghela

Reputation: 22945

Try doing this way , may solve your issue

if you are using compile files('libs/volley.jar') than you dont need following

Try removing

compile files('libs/httpclient-4.2.3.jar')
compile files('libs/httpcore-4.2.2.jar')
compile files('libs/httpmime-4.2.3.jar')
compile files('libs/picasso-2.5.2.jar')

Upvotes: 0

Related Questions