Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App (2015) Networking Getting the OkHttp Library Using Gradle

CD Lim
CD Lim
4,782 Points

what is "duplicate file during packaging APK"?

cant launch my emulator

Hi CD,

What was the full "Error:" message text generated?

CD Lim
CD Lim
4,782 Points

Hi Evan, Thanks for your reply. The following is the "Error." message

(1) Error:duplicate files during packaging of APK /Users/CDLIM/AndroidStudioProjects/Stormy/app/build/outputs/apk/app-debug-unaligned.apk

(2) Error:Execution failed for task ':app:packageDebug'.

Duplicate files copied in APK LICENSE.txt File 1: /Users/CDLIM/.gradle/caches/modules-2/files-2.1/junit/junit/4.11/4e031bb61df09069aeb2bffb4019e7a5034a4ee0/junit-4.11.jar File 2: /Users/CDLIM/.gradle/caches/modules-2/files-2.1/org.hamcrest/hamcrest-core/1.3/42a25dc3219429f0e5d060061f71acb49bf010a0/hamcrest-core-1.3.jar

I was following Ben Jakuben's "Build an App Weather" course. I am only at the first few videos and *I have not alter anything in Android Studio except in Build.gradle(module app) *

the following are the codes in build.gradle(module app)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "23.0.0 rc2"

    defaultConfig {
        applicationId "com.example.cdlim.stormy"
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile 'com.squareup.okhttp:mockwebserver:2.7.0'
}

Thanks again for looking into it and for your time.

Regards CD Lim

2 Answers

Hi CD,

Try adding the following to your build.gradle after your closing bracket for buildTypes:

packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/DEPENDENCIES'
}
CD Lim
CD Lim
4,782 Points

Hi, I tried using that but it didn't work =(

Regards

At this point I'd recommend downloading the project files (which we know should work) and running that; if it works, compare the code in the working project to your own code to see what's different.