无法创建发布密钥库 - 任务执行失败':app:transformClassesWithDexForRelease'

时间:2017-08-09 09:09:27

标签: java android android-studio

我正在尝试构建我的发布版apk和Android Stdio给了我错误。我多次清理和构建项目,但错误仍然存​​在。在build.gradle文件中启用了Multidex,我还使用Proguard来缩小代码。这些解决方案都不适合我。

错误:任务':app:transformClassesWithDexForRelease'执行失败。

Error:Execution failed for task ':app:transformClassesWithDexForRelease'.

com.android.build.api.transform.TransformException: 
com.android.ide.common.process.ProcessException: 
java.util.concurrent.ExecutionException: 
com.android.ide.common.process.ProcessException: Error while executing java 
process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --multi-dex --main-dex-list C:\Users\azats\Desktop\App\app\build\intermediates\multi-dex\release\maindexlist.txt --output C:\Users\azats\Desktop\App\app\build\intermediates\transforms\dex\release\folders\1000\1f\main C:\Users\azats\Desktop\App\app\build\intermediates\transforms\jarMerging\release\jars\1\1f\combined.jar}

这是我的gradle文件

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'

android {
signingConfigs {
config {
    keyAlias 'key1'
    keyPassword 'torres1984'
    storeFile file('C:/Users/azats/Desktop/release-keystore.jks')
    storePassword 'aniki1995'

  }
}
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.makeuprewardz.app"
minSdkVersion 16
targetSdkVersion 25
versionCode 4
versionName "4.0"
multiDexEnabled  true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
  release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    signingConfig signingConfigs.config
   }
}
dexOptions {
   javaMaxHeapSize "2g"
   preDexLibraries = false

}
compileOptions {
 sourceCompatibility JavaVersion.VERSION_1_8
 targetCompatibility JavaVersion.VERSION_1_8
 }
  packagingOptions {
   exclude 'META-INF/ASL2.0'
   exclude 'META-INF/LICENSE'
   exclude 'META-INF/NOTICE'
   exclude 'META-INF/NOTICE.txt'
   exclude 'META-INF/LICENSE.txt'
   exclude 'META-INF/MANIFEST.MF'
   }
 }

repositories {
mavenCentral()
maven { url "https://bitbucket.org/adscend/androidsdk/raw/master/" }
maven { url "https://jitpack.io" }
 jcenter()
 flatDir {
  dirs 'libs'
  }
 }

  dependencies {
 compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
  exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.github.medyo:fancybuttons:1.8.3'
compile 'com.google.code.gson:gson:2.8.0'
compile 'me.yokeyword:fragmentation:0.10.4'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'jp.wasabeef:glide-transformations:2.0.2'
compile 'com.afollestad.material-dialogs:core:0.9.4.4'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.jude:easyrecyclerview:4.4.0'
compile 'com.github.GrenderG:Toasty:1.1.3'
compile 'com.github.medyo:android-about-page:1.2'
compile 'com.google.firebase:firebase-auth:11.0.1'
compile 'com.google.android.gms:play-services-auth:11.0.1'
compile 'com.google.android.gms:play-services-iid:11.0.1'
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
compile 'com.google.firebase:firebase-storage:11.0.1'
compile 'com.google.firebase:firebase-ads:11.0.1'
compile 'com.github.lygttpod:SuperTextView:1.1.2'
compile 'com.brucetoo.pickview:library:1.2.3'
compile 'com.zhihu.android:matisse:0.4.3'
compile 'me.weyye.hipermission:library:1.0.3'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.squareup.okio:okio:1.12.0'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.network.connectionclass:connectionclass:1.0.1'
compile 'com.facebook.android:audience-network-sdk:4.21.1'
compile 'com.google.android.gms:play-services-basement:11.0.1'
compile 'com.google.android.gms:play-services-location:11.0.1'
compile 'io.github.kobakei:ratethisapp:1.2.0'
compile 'com.kyleduo.switchbutton:library:1.4.6'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.adscendmedia.sdk:adscendmedia:2.3.2'
compile 'com.pollfish:pollfish:+:googleplayRelease@aar'
compile(name: 'OfferToroSdk-v3.1.3', ext: 'aar')
compile(name: 'adgatemediasdk', ext: 'aar')
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile files('libs/SuperRewards-3.1b.jar')
}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
    if (!requested.name.startsWith("multidex")) {
        details.useVersion '25.3.1'
        }
      }
   }
}
apply plugin: 'com.google.gms.google-services'

1 个答案:

答案 0 :(得分:0)

可能你已经多次添加了一些依赖,只是通过你的依赖。

我发现其中一个是

  

SuperRewards-3.1b.jar

您正在使用

  

编译fileTree(包括:['* .jar'],dir:'libs')

然后不需要添加此

  

编译文件('libs / SuperRewards-3.1b.jar')

从依赖项中删除此compile files('libs/SuperRewards-3.1b.jar')行,因为compile fileTree(include: ['*.jar'], dir: 'libs')会自动添加该lib。

相关问题