2017-01-04 54 views
2

我在build.gradle文件中添加了以下依賴項。從@aar,gradle dependency中排除軟件包/類

compile 'com.aerisweather:aeris-maps-lib:[email protected]' 

距離

https://oss.sonatype.org/content/repositories/comaerisweather-1027/com/aerisweather/aeris-maps-lib/2.0.0/

如果你看到下面的URL文物,它支持Android V7庫類。

https://oss.sonatype.org/#nexus-search;quick~aerisweather

我想運行/打包應用程序時排除包。由於重複的類錯誤,我無法運行/打包應用程序。

我已經嘗試添加配置這樣,

configurations { 
    all*.exclude group: 'com.android.support', module: 'appcompat-v7' 
} 

但是,這不包括它這使我錯誤很多,整個項目。

我已經嘗試了一切,但仍然出現以下錯誤。

Error:Execution failed for task ':transformClassesWithJarMergingForDebug'. com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/appcompat/R$anim.class

回答

0

這個圖書館的還依賴support-v4mediarouter-v7

您需要將它們全部從aeris-maps-lib中排除,並將其作爲您自己的依賴項。

def supportLibraryVersion = '25.0.1' 
dependencies { 
    compile "com.android.support:support-v4:${supportLibraryVersion}" 
    compile "com.android.support:support-annotations:${supportLibraryVersion}" 
    compile "com.android.support:appcompat-v7:${supportLibraryVersion}" 

    //... other deps 

    compile ('com.aerisweather:aeris-maps-lib:[email protected]', { 
     exclude group: 'com.android.support', module: 'support-v4' 
     exclude group: 'com.android.support', module: 'appcompat-v7' 
     exclude group: 'com.android.support', module: 'mediarouter-v7' 
    }) 
} 

PS。

aeris-maps-lib也有com.google.android.gms:play-services依賴關係,這是整個Play Services包(它很大),您需要啓用MultiDex或使用proguard縮小代碼。

+0

不工作,我不斷收到相同的錯誤消息「java.util.zip.ZipException:重複條目:android/support/v7/appcompat/R $ anim.class」 –

+0

您是否在應用更改後清理項目? –

+0

是的,我試過了,還是一樣的錯誤。 –

相關問題