2017-06-27 33 views
0

enter image description here我想從jar中排除一個類,但它不起作用。 讓我知道很熱。如何在Android Studio中從jar中排除一個類

這是我的代碼:

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile ('com.google.android.gms:play-services-gcm:8.3.0') { 
     exclude module: 'com.google.android.gms.iid/zzb' 
    } 
    compile 'org.xwalk:xwalk_core_library:14.43.343.17' 
    compile 'com.google.code.gson:gson:2.4' 
    compile 'commons-io:commons-io:2.4' 
    compile 'com.google.android.gms:play-services-analytics:10.2.1' 
    compile project(":adjust") 
} 

這是錯誤消息:

Error:Execution failed for task ':app:packageAllReleaseClassesForMultiDex'. 
> java.util.zip.ZipException: duplicate entry: com/google/android/gms/iid/zzb$zza$zza.class 
+0

您應該嘗試更新'com.google.android.gms:play-services-gcm:8.3.0'以與相同版本的'com.google.android.gms:play-服務分析:10.2.1' –

+0

謝謝。但我遵循了你的方向,'GoogleCloudMessaging'不起作用。 – user6191333

+0

它會給你一個特定的錯誤嗎? –

回答

0

在普通的搖籃,你在尋找什麼可以實現爲:

dependencies { 
    compile('com.example.m:m:1.0') { 
    exclude group: 'org.unwanted', module: 'x 
    } 
    compile 'com.example.l:1.0' 
} 

這會排除模塊X與M的依賴關係,但是如果依賴於L,它仍會帶來它。