Выпуск Android. Сбой сборки из-за сжатия. RleleaseMultiDexComponents.

У меня возникли трудности с созданием версии моего приложения.

Это часть результата, который я получаю при запуске ./gradlew assembleRelease --stacktrace --debug

В Android Studio он выплескивает одно и то же, и я просканировал сеть, но не нашел для этого решения.

 17:57:41.664 [INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Executing task ':app:shrinkReleaseMultiDexComponents' (up-to-date check took 0.002 secs) due to: No history is available. 17:57:41.665 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':app:shrinkReleaseMultiDexComponents'. 17:57:41.717 [INFO] [system.out] ProGuard, version 5.2.1 17:57:41.745 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':app:shrinkReleaseMultiDexComponents' 17:57:41.745 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :app:shrinkReleaseMultiDexComponents FAILED 17:57:41.746 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :app:shrinkReleaseMultiDexComponents (Thread[main,5,main]) completed. Took 0.091 secs. 17:57:41.747 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[main,5,main]] finished, busy: 8.329 secs, idle: 0.049 secs 17:57:41.771 [ERROR] [org.gradle.BuildExceptionReporter] 17:57:41.774 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. 17:57:41.774 [ERROR] [org.gradle.BuildExceptionReporter] 17:57:41.775 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 17:57:41.775 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':app:shrinkReleaseMultiDexComponents'. 17:57:41.782 [ERROR] [org.gradle.BuildExceptionReporter] > java.io.IOException: The output jar [/Users/jacob/Documents/MyApp/app/build/intermediates/multi-dex/release/componentClasses.jar] must be specified after an input jar, or it will be empty. 17:57:41.783 [ERROR] [org.gradle.BuildExceptionReporter] 17:57:41.795 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is: 17:57:41.797 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:shrinkReleaseMultiDexComponents'. 17:57:41.797 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) 17:57:41.797 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) 17:57:41.798 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) 17:57:41.798 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) 17:57:41.798 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) 17:57:41.799 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42) 17:57:41.799 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) 17:57:41.799 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) 17:57:41.799 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) 17:57:41.800 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305) 17:57:41.800 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79) 17:57:41.800 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63) 17:57:41.800 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51) 17:57:41.800 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23) 17:57:41.801 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88) 17:57:41.801 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29) 17:57:41.801 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62) 17:57:41.801 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23) 17:57:41.802 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68) 17:57:41.802 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) 17:57:41.802 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62) 17:57:41.802 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55) 17:57:41.802 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149) 17:57:41.803 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106) 17:57:41.803 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86) 17:57:41.803 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80) 17:57:41.804 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33) 17:57:41.804 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24) 17:57:41.804 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36) 17:57:41.804 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26) 17:57:41.805 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51) 17:57:41.807 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171) 17:57:41.807 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237) 17:57:41.809 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210) 17:57:41.810 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35) 17:57:41.810 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24) 17:57:41.811 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206) 17:57:41.812 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) 17:57:41.813 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) 17:57:41.814 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) 17:57:41.814 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:33) 17:57:41.815 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) 17:57:41.815 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54) 17:57:41.816 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35) 17:57:41.816 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:23) 17:57:41.817 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33) 17:57:41.818 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130) 17:57:41.819 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48) 17:57:41.819 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.internal.UncheckedException: java.io.IOException: The output jar [/Users/jacob/Documents/MyApp/app/build/intermediates/multi-dex/release/componentClasses.jar] must be specified after an input jar, or it will be empty. 17:57:41.819 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:39) 17:57:41.819 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:66) 17:57:41.820 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218) 17:57:41.820 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211) 17:57:41.820 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200) 17:57:41.820 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:579) 17:57:41.821 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:562) 17:57:41.821 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) 17:57:41.821 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) 17:57:41.821 [ERROR] [org.gradle.BuildExceptionReporter] ... 47 more 17:57:41.821 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.IOException: The output jar [/Users/jacob/Documents/MyApp/app/build/intermediates/multi-dex/release/componentClasses.jar] must be specified after an input jar, or it will be empty. 17:57:41.822 [ERROR] [org.gradle.BuildExceptionReporter] at proguard.ConfigurationChecker.check(ConfigurationChecker.java:64) 17:57:41.822 [ERROR] [org.gradle.BuildExceptionReporter] at proguard.ProGuard.execute(ProGuard.java:73) 17:57:41.822 [ERROR] [org.gradle.BuildExceptionReporter] at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074) 17:57:41.822 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63) 17:57:41.822 [ERROR] [org.gradle.BuildExceptionReporter] ... 54 more 17:57:41.823 [ERROR] [org.gradle.BuildExceptionReporter] 17:57:41.823 [LIFECYCLE] [org.gradle.BuildResultLogger] 17:57:41.823 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED 17:57:41.823 [LIFECYCLE] [org.gradle.BuildResultLogger] 17:57:41.823 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 25.463 secs 

Это моя конфигурация

 buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' repositories { maven { url 'https://maven.fabric.io/public' } } android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.MyApp" minSdkVersion 16 targetSdkVersion 23 versionCode 9 versionName "0.9.3" multiDexEnabled = true } packagingOptions { exclude 'META-INF/NOTICE' exclude 'META-INF/DEPENDENCIES.txt' exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/notice.txt' exclude 'META-INF/license.txt' exclude 'META-INF/dependencies.txt' exclude 'META-INF/LGPL2.1' } useLibrary 'org.apache.http.legacy' buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-android-optimize.txt' } } } dependencies { compile files('libs/org.apache.http.legacy.jar') compile 'org.apache.httpcomponents:httpclient-android:4.3.5' compile('org.apache.httpcomponents:httpmime:4.3.5') { exclude module: 'org.apache.httpcomponents:httpclient' } compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.google.android.gms:play-services:7.5.0' compile 'com.mixpanel.android:mixpanel-android:4.6.2' compile 'com.android.support:recyclerview-v7:23.0.1' compile 'com.facebook.android:facebook-android-sdk:4.1.0' compile 'com.soundcloud.android:android-crop:1.0.0@aar' compile 'com.android.support:support-v4:23.0.1' compile('com.crashlytics.sdk.android:crashlytics:2.5.1@aar') { transitive = true; } } 

заранее спасибо

Solutions Collecting From Web of "Выпуск Android. Сбой сборки из-за сжатия. RleleaseMultiDexComponents."

Я столкнулся с одной и той же проблемой, и мне удалось создать подписанный apk, просто отключив minifyEnable в release buildType:

 minifyEnabled false 

ОБНОВИТЬ:

Я смог исправить проблему, добавив следующее в конфигурацию proguard (файл proguard-rules.pro):

 -dontwarn javax.naming.** 

Это очистит / пропустит все предупреждения при компиляции и устранит проблему в моей стороне.

Пролог, который исправил проблему для меня

Следующий файл конфигурации proguard оказался для меня трюком.

 # This is a configuration file for ProGuard. # http://proguard.sourceforge.net/index.html#manual/usage.html # Optimizations: If you don't want to optimize, use the # proguard-android.txt configuration file instead of this one, which # turns off the optimization flags. Adding optimization introduces # certain risks, since for example not all optimizations performed by # ProGuard works on all versions of Dalvik. The following flags turn # off various optimizations known to have issues, but the list may not # be complete or up to date. (The "arithmetic" optimization can be # used if you are only targeting Android 2.0 or later.) Make sure you # test thoroughly if you go this route. -optimizations !code/simplification/arithmetic,!code/simplification/cast,!field/*,!class/merging/* -optimizationpasses 5 -allowaccessmodification -dontpreverify # The remainder of this file is identical to the non-optimized version # of the Proguard configuration file (except that the other file has # flags to turn off optimization). -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -verbose -dontwarn javax.xml.** -keepattributes *Annotation* -keep public class com.google.vending.licensing.ILicensingService -keep public class com.android.vending.licensing.ILicensingService # For native methods, see http://proguard.sourceforge.net/manual/examples.html#native -keepclasseswithmembernames class * { native <methods>; } # keep setters in Views so that animations can still work. # see http://proguard.sourceforge.net/manual/examples.html#beans -keepclassmembers public class * extends android.view.View { void set*(***); *** get*(); } # We want to keep methods in Activity that could be used in the XML attribute onClick -keepclassmembers class * extends android.app.Activity { public void *(android.view.View); } # For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; } -keepclassmembers class **.R$* { public static <fields>; } -keepattributes SourceFile,LineNumberTable -dontusemixedcaseclassnames -dontskipnonpubliclibraryclasses -verbose -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } -keep class android.support.v7.app.** { *; } -keep interface android.support.v7.app.** { *; } -keepattributes Signature -keep class com.crashlytics.** { *; } -dontwarn com.crashlytics.** -keep class org.apache.http.** { *; } -keep class org.apache.commons.codec.** { *; } -keep class org.apache.commons.logging.** { *; } -keep class android.net.compatibility.** { *; } -keep class android.net.http.** { *; } -keep class com.android.internal.http.multipart.** { *; } -dontwarn org.apache.http.** -dontwarn android.webkit.** -dontwarn org.apache.http.** -dontwarn android.net.http.AndroidHttpClient -dontwarn com.google.android.gms.** -dontwarn com.android.volley.toolbox.** -dontwarn soundcloud.android.crop.* -dontwarn org.apache.** -dontwarn android.webkit.** -dontwarn com.mixpanel.android.** -dontwarn com.google.android.** -dontwarn java.lang.invoke** -dontwarn org.apache.lang.** -dontwarn org.apache.commons.** -keep class com.MyApp.subscreens.Search -keep class android.support.v7.widget.** { *; } # The support library contains references to newer platform versions. # Don't warn about those in case this app is linking against an older # platform version. We know about them, and they are safe. -dontwarn android.support.** 

Убедитесь, что входная банка существует. Поскольку проблема

 proguard.ConfigurationChecker.check(ConfigurationChecker.java:64) 

Происходит со мной с proguard 5.2.1, когда наборы пустых (файлы не существуют или не найдены). Так, например,

 task proguard(type: ProGuardTask) { injars inputJar outjars outPutJar ... } 

Если inputJar не существует, то ConfigurationChecker будет жаловаться.

Я посмотрел на код и обнаружил, что ProGuardTask добавляет баны в путь к классам, если они существуют или являются выходами. Проверьте строку 1180 в ProGuardTask.java по адресу http://grepcode.com/file/repo1.maven.org/maven2/net.sf.proguard/proguard-gradle/5.2.1/proguard/gradle/ProGuardTask.java?av = F # 1180

 while (fileIterator.hasNext()) { File file = (File)fileIterator.next(); if (output || file.exists()) { //skip classPath.add(classPathEntry); } }