无法登录发布APK - :应用:shrinkReleaseMultiDexComponents失败 [英] Unable to sign release APK - :app:shrinkReleaseMultiDexComponents FAILED

查看:1183
本文介绍了无法登录发布APK - :应用:shrinkReleaseMultiDexComponents失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想生成一个签署过的APK和日志不断显示我以下错误:

I'm trying to generate a signed apk and the log keeps showing me the following error:

:app:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileReleaseNdk UP-TO-DATE
:app:compileReleaseSources
:app:collectReleaseMultiDexComponents
:app:proguardRelease
Warning:com.google.android.gms.internal.zzac: can't find referenced class android.net.http.AndroidHttpClient
Warning:com.google.android.gms.internal.zzw: can't find referenced method 'void addHeader(java.lang.String,java.lang.String)' in program class com.google.android.gms.internal.zzw$zza
Warning:com.google.android.gms.internal.zzw$zza: can't find referenced method 'void setURI(java.net.URI)' in program class com.google.android.gms.internal.zzw$zza
Warning:com.ironsource.mobilcore.j: can't find referenced method 'void setLatestEventInfo(android.content.Context,java.lang.CharSequence,java.lang.CharSequence,android.app.PendingIntent)' in library class android.app.Notification
Warning:com.mopub.volley.toolbox.HttpClientStack: can't find referenced method 'void addHeader(java.lang.String,java.lang.String)' in program class com.mopub.volley.toolbox.HttpClientStack$HttpPatch
Warning:com.mopub.volley.toolbox.HttpClientStack$HttpPatch: can't find referenced method 'void setURI(java.net.URI)' in program class com.mopub.volley.toolbox.HttpClientStack$HttpPatch
Warning:com.mopub.volley.toolbox.Volley: can't find referenced class android.net.http.AndroidHttpClient
Warning:there were 4 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning:there were 4 unresolved references to program class members.
         Your input classes appear to be inconsistent.
         You may need to recompile the code.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedprogramclassmember)
Warning:there were 1 unresolved references to library class members.
         You probably need to update the library versions.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Exception while processing task 
java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:473)
    at proguard.ProGuard.initialize(ProGuard.java:233)
    at proguard.ProGuard.execute(ProGuard.java:98)
    at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
    at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
    at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
    at com.android.builder.tasks.Job.runTask(Job.java:48)
    at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
    at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
    at java.lang.Thread.run(Thread.java:745)
:app:shrinkReleaseMultiDexComponents FAILED
Error:Execution failed for task ':app:shrinkReleaseMultiDexComponents'.
> java.io.IOException: The output jar [<project_path>\app\build\intermediates\multi-dex\release\componentClasses.jar] must be specified after an input jar, or it will be empty.

下面是我的应用级的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.my.app"
        minSdkVersion 14
        targetSdkVersion 23
        versionCode 25
        versionName "2.5"

        // Enabling multidex support.
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    dexOptions {
        incremental true
        javaMaxHeapSize "2048M"
    }
}

repositories {
    mavenCentral()
    maven { url "https://jitpack.io" }
}

dependencies {
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.android.support:recyclerview-v7:23.0.1'
    compile 'com.google.android.gms:play-services:8.1.0'
    compile 'com.google.code.gson:gson:2.3.1'
    compile 'com.squareup.okhttp:okhttp:2.4.0'
    compile 'com.facebook.android:facebook-android-sdk:4.2.0'
    compile 'me.dm7.barcodescanner:zxing:1.7.2'
    compile 'de.hdodenhof:circleimageview:1.3.0'
    compile 'com.scottyab:secure-preferences-lib:0.1.3'
    compile 'com.soundcloud.android:android-crop:1.0.0@aar'
    compile('com.afollestad.material-dialogs:core:0.8.1.0@aar') {
        transitive = true
    }
    compile('com.mopub:mopub-sdk:3.13.0@aar') {
        transitive = true
    }
    compile project(':android-support-v4-preferencefragment')
    compile project(':circular_progress_bar')
    compile files('libs/mobilecore_V1.1.jar')
    compile files('libs/libAdapterSDKMoPub.jar')
    compile files('libs/adcolony.jar')
}

和我的顶级的build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

我已经试过的gradle与其他版本一样 1.4.0-β1',1.4.0-β2 1.3.1 仍然没有运气。

推荐答案

有一些信息正确的,在你的跟踪 -

There is some info right there in your trace --

警告:有以类或接口4未解决的引用。
           您可能需要添加缺少的jar包或更新它们的版本。
           如果你的code正常工作而不缺少类,您可以燮preSS
           警告与'-dontwarn'选项。
           ( http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass

Warning:there were 4 unresolved references to classes or interfaces. You may need to add missing library jars or update their versions. If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options. (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)

在你的问题中至少有一部分是 AndroidHttpClient 在API 23已被删除,你的库中的至少一个依赖于它。你有三个选择。

At least part of your problem is that AndroidHttpClient was removed in API 23, and at least one of your libraries depends on it. You have three options.

1)您可以在您的的build.gradle 文件以下。其中包括您的APK遗留库。见<一href=\"https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client\"相对=nofollow> Apache的HTTP客户端删除。

1) You can include the following in your build.gradle file. Which includes the legacy library in your apk. See Apache HTTP Client Removal.

android {
    useLibrary 'org.apache.http.legacy'
}

2)你可以降低你的目标和编译SDK到22,而不是23那应该让你编译,或者至少解决 AndroidHttpClient 的问题,直到库更新不要求它。

2) You can lower your target and compile sdk to 22 instead of 23. That should allow you to compile, or at least resolve the AndroidHttpClient issue until the libraries are updated to not require it.

3)您可以添加 -dontwarn 命令你的ProGuard文件燮preSS的警告得到一个版本。正如文件中所指出的,如果你不能确定的警告可以安全地忽略这可能是危险的。我不能肯定,如果忽视从去除的HttpClient 和相关类所产生的安全与否警告。 M上运行时,它可能会导致不稳定的构建,而应为L和下方是安全的,因为这些类在那个API层面上的设备存在。

3) You can add -dontwarn commands to your proguard file to suppress the warns to get a build. As noted in the documentation, this can be dangerous if you aren't certain the warnings can be safely ignored. I am not certain if ignoring warnings stemming from the removal of HttpClient and associated classes is safe or not. It might lead to an unstable build when running on M, but should be safe for L and below because those classes exist on devices at that API level.

增加:
因为凡斗争一样,请记住,你必须降低你的 builToolsVersion com.android.support 在依赖于 22.0.1

这篇关于无法登录发布APK - :应用:shrinkReleaseMultiDexComponents失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆