大家好,我有一个关于使用 android studio 生成签名 apk 的问题。
我对此进行了很多搜索,但在我的案例中没有找到有效的解决方案,我知道这是与重复类条目相关的问题,但任何人都可以告诉我我需要排除哪些。
我尝试执行以下操作,但没有用。
{
exclude group: 'com.payu.custombrowser', module: 'customBrowser'
}
这是我在生成签名 apk 时遇到的错误
Error:Execution failed for task ':transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/payu/custombrowser/BuildConfig.class
下面是我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "company.app.appname"
minSdkVersion 9
targetSdkVersion 23
multiDexEnabled true
}
aaptOptions {
useNewCruncher false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
zipAlignEnabled true
}
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':hellochartslibrary')
compile project(':customBrowser')
compile project(':facebook')
compile 'com.android.support:support-v4:23.3.0'
compile 'com.google.code.gson:gson:2.4'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:appcompat-v7:23.3.0'
我不知道我必须排除什么才能解决这个问题,有谁知道请帮助我。
EDIT NOTE:
If i directly run the app means without generate signed apk than its work fine there is no error log but it show me only when i'm trying to generate signed apk
最佳答案
您已经使用 compileTree
指令引用了那些 jar 文件,因此可能不需要所有这些 compile files
条目。
此外,编译 'com.google.android.gms:play-services:8.4.0'
,您将包括整个 Play 服务,这些服务的模块化版本可能有助于避免首先是 MultiDex。
关于android - TransformClassesWithJarMergingForRelease Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36661287/