[Android] Problem z budowaniem appki z zależnością maven

0

Mam problem ze zbudowaniem apki w Android Studio gdy mam dołączoną jakąś zależność mavenową.

plik build.gradle (Module: app)

apply plugin: 'com.android.application'
repositories {
    mavenCentral()
    mavenLocal()
}
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"

    defaultConfig {
        applicationId "com.app.enjoy"
        minSdkVersion 10
        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 fileTree(dir: 'libs', include: ['*.jar'])
    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.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.3.1'
    compile 'com.someproject:Commons:1.0.0-SNAPSHOT'
    testCompile 'junit:junit:4.12'
}

Podczas pudowania wyświetla się błąd:

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/INDEX.LIST
	File1: C:\Users\jo\.gradle\caches\modules-2\files-2.1\io.netty\netty-buffer\4.0.44.Final\da53aca0dfb9b808d0bd162fddaf49dc592ef989\netty-buffer-4.0.44.Final.jar
	File2: C:\Users\jo\.gradle\caches\modules-2\files-2.1\io.netty\netty-transport\4.0.44.Final\4d8115b3fd5ae43629c393ba203aa0922910efde\netty-transport-4.0.44.Final.jar
	File3: C:\Users\jo\.gradle\caches\modules-2\files-2.1\io.netty\netty-codec\4.0.44.Final\a5f58d9b241c1b6f421bbc6cbed8517a74759b6a\netty-codec-4.0.44.Final.jar
	File4: C:\Users\jo\.gradle\caches\modules-2\files-2.1\io.netty\netty-handler\4.0.44.Final\8be37d4fdf522a14e676620bbd893398034adb02\netty-handler-4.0.44.Final.jar

Gdy usunę linie:

compile 'com.someproject:Commons:1.0.0-SNAPSHOT'

To wtedy działa... Jakieś pomysły? jak robie excluda tych tego pliku to wtedy sypie sie na innym i jak dodam ten kolejny to wywala sie cos na targetach javy 1.7 ;/

0

zależność mavena to:

compile 'com.someproject:Commons:1.0.0-SNAPSHOT'
0

Dobra rozwiązałem to w taki sposób (Może sie komuś przyda, dodałem obsługe javy 1.8 plus jackoption i multiDexEnabled na true):

apply plugin: 'com.android.application'
repositories {
    mavenCentral()
    mavenLocal()
}
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    packagingOptions {
        exclude 'META-INF/INDEX.LIST'
        exclude 'META-INF/io.netty.versions.properties'
    }
    defaultConfig {
        applicationId "com.app.enjoy"
        minSdkVersion 10
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        jackOptions {
            enabled true
        }
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    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.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:25.3.1'
    compile 'com.some:Commons:1.0.0-SNAPSHOT'
    testCompile 'junit:junit:4.12'
}

1 użytkowników online, w tym zalogowanych: 0, gości: 1