2017-10-19 42 views
0

我無法建立我的應用程序突然。機器人工作室:即使複製文件時使用排除修復

錯誤:

Error:Execution failed for task 
Duplicate files copied in APK lib/x86_64/libogg.so 

File1: C:\Users\name\.android\build-cache\72c018be052ae391eef4ab43483d6a04be10a818\output\jni 

File2: C:\Users\name\.android\build-cache\425f82e82c18acce2ff0ced2ade670804d31a815\output\jni 

我試圖用的包裝選項來解決:

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

整個文件

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.1" 
    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES.txt' 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/LGPL2.1' 
    } 
     defaultConfig { 
     applicationId "myappsid" 
     minSdkVersion 19 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     vectorDrawables.useSupportLibrary = true 

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

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:26.0.0' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile 'com.android.support:design:26.0.1' 
    compile 'com.android.support:support-v4:26' 
    compile 'com.android.support:support-vector-drawable:26' 
    compile 'org.apache.commons:commons-io:1.3.2' 
    compile 'com.google.android.gms:play-services-ads:11.0.4' 
    compile 'com.ibm.watson.developer_cloud:android-sdk:0.4.2' 
    compile 'com.ibm.watson.developer_cloud:java-sdk:3.9.1' 
    testCompile 'junit:junit:4.12' 
    compile project(':library-release') 

} 

任何幫助是極大的讚賞。我試圖不再排除選項,以及中,我發現,但這並沒有幫助其他職位。

回答

1

您可以嘗試使用pickFirstpackagingOptions。你需要從文件1文件2得到libogg.so正確的軟件包名稱:

packagingOptions { 

    pickFirst 'com/library/name/lib/x86_64/libogg.so' 

    ... 
} 

UPDATE

有一個衝突的依賴關係:

compile 'com.ibm.watson.developer_cloud:android-sdk:0.4.2' 
compile 'com.ibm.watson.developer_cloud:java-sdk:3.9.1' 

Watson Developer Cloud Java SDK文檔可以找到以下內容:

The Android SDK utilizes the Java SDK while making some Android-specific additions. This repository can be found here . It depends on OkHttp and gson.

這是指向第一個庫。所以,你應該只使用:

compile 'com.ibm.watson.developer_cloud:android-sdk:0.4.2' 
+0

我沒有嘗試過,但它現在工作,但現在我得到同樣的問題只是不同的文件。 – lostknight

+0

什麼是錯誤你嘗試之後? –

+0

同樣的錯誤只是不同的文件中像libspeex.so – lostknight