简体   繁体   English

如何从Android Studio中的jar中排除类

[英]How to exclude a class from jar in Android Studio

在此处输入图片说明 I'm trying to exclude a class from jar, but it doesn't work. 我正在尝试从jar中排除一个类,但是它不起作用。 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: 在简单的Gradle中,您所寻找的可以通过以下方式实现:

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. 这会将模块X从M的依赖项中排除,但是如果您依赖于L,它将仍然带来它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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