简体   繁体   中英

How to exclude a class from jar in Android Studio

在此处输入图片说明 I'm trying to exclude a class from jar, but it doesn't work. Let me know hot to do it.

This is my code:

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")
}

This is the error message:

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

In plain Gradle, what you are looking for can be achieved as:

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

This would exclude the module X from the dependencies of M, but will still bring it if you depend on L.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM