- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我在 android studio 中有一个用于 Android 应用程序的项目。该项目有 6 个模块(3 个内部库、一个 Android 应用程序模块、一个可穿戴模块和一个在应用程序和可穿戴设备之间共享代码的模块),在我们决定更改该应用程序的最小 Android SDK 之前,一切都运行良好。
它最初兼容 16+,我们想让它支持 21+。我们尝试仅更改最小 sdk,升级最小 sdk 和编译 sdk(到 23 和 24 或 21 ...),甚至升级构建工具(到 23 of 24)但似乎没有任何效果......当我出于我真的不明白的原因启用 gradle 守护进程时,我设法让它“有时”工作,但这对于我们在 CI 上构建并不是一个好的选择。
所以我完全绝望地问是否有人知道可能是什么问题......
错误是 com.android.build.api.transform.TransformException: java.util.zip.ZipException: error in opening zip file.我在构建时从未见过它,但我们也运行“connectedAndroidTest”,我们似乎打包了每个模块,这个错误发生在随机模块中,并且使用 --info 或 --debug 构建不指示打开哪个 zip 文件导致错误。 .
1:Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shared:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: error in opening zip file
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':common:messages:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: error in opening zip file
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
==============================================================================
3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':common:upnp:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: error in opening zip file
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
==============================================================================
4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':common:utils:transformClassesWithDexForDebugAndroidTest'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: error in opening zip file
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
==============================================================================
完整的堆栈:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':common:utils:transformClassesWithDexForDebugAndroidTest'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:153)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:40)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:237)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: com.android.build.api.transform.TransformException: java.util.zip.ZipException: error in opening zip file
at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:54)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:57)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:47)
at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:173)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 71 more
Caused by: com.android.build.api.transform.TransformException: java.util.zip.ZipException: error in opening zip file
at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:423)
at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:178)
at com.android.build.gradle.internal.pipeline.TransformTask$3.call(TransformTask.java:174)
at com.android.builder.profile.ThreadRecorder$1.record(ThreadRecorder.java:55)
... 84 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
at com.android.builder.core.AndroidBuilder.checkLibraryClassesJar(AndroidBuilder.java:1799)
at com.android.builder.core.AndroidBuilder.convertByteCode(AndroidBuilder.java:1464)
at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:406)
... 87 more
最佳答案
如果错误不在 gradle zip 而在 jar 本身,请确保您的 compileSdkVersion、buildToolsVersion 和 targetSdkVersion 是一致的。
如果错误仍然存在,请尝试使用不同版本的 android gradle 插件构建,我在使用 com.android.tools.build:gradle:2.1.3 时遇到了类似的问题,并且在升级到 2.2 后它消失了。 0
关于Android Gradle 产生 TransformException : java. util.zip.ZipException:在 transformClassesWithDexForRelease 期间打开 zip 文件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40127265/
我在使用 Remote Display API 的 Chromecast 项目中遇到“Error converting bytecode to dex”。我通过添加“multiDexEnabled t
我正在尝试将MoPub集成到我的应用程序中。 我将SDK导入了我的应用程序: compile('com.mopub.sdk.android:mopub:4.4.1@aar') { transi
尝试在Android Studio中生成签名的APK文件时出现以下错误: Error:Execution failed for task ':app:transformClassesWithJarMe
我的 gradle.build 文件如下所示: apply plugin: 'com.android.application' android { compileSdk
当我尝试在运行时使用 iText 生成 PDF 时出现错误。当应用程序在设备或 geny Motion 中运行时会出现错误。 Error:Execution failed for task ':app
我试图将一个有效的 Eclipse Android 项目导入到 Android Studio。我正在使用最新版本的 Android Studio 在 Mac 上工作。当我尝试构建时,它一直显示此错误:
每次出现 RuntimeException、TransformException、ArgumentException 时,我都需要重建项目。我认为问题出在 Gradle 文件中。 异常:运行时异常:c
为什么我会收到此错误,当我同步 gradle 时不会发生,但当我运行项目时会收到此错误。 任务“:app:transformClassesWithJarMergingForDebug”执行失败。
在我向我的 Android 项目添加一些资源后,我突然遇到了这个奇怪的异常。该应用程序完全停止构建并抛出以下异常: Error:Execution failed for task ':app:tran
这从我添加 google-api-services-calendar 开始。尝试构建时出现此错误: Error:Execution failed for task ':app:transformCla
在我的单元测试中,我试图通过将一些格式错误的 xml 发送到 javax.xml.transform.Transformer 的 org.apache.xalan.processor.Transfor
我无法构建Android Studio项目。我收到此错误: Error:Execution failed for task ':app:transformClassesWithDexForDebug'
错误:任务“:app:transformClassesWithDependencyCheckerForDebug”执行失败。 org.gradle.api.internal.changedetecti
在android studio中构建项目时出现以下错误 com.android.build.api.transform.TransformException: java.util.zip.ZipExc
我收到这个错误 Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android
当我尝试使用Android Studio运行应用程序时,出现以下异常: Error:Execution failed for task ':app:transformClassesWithDexFor
我将一些现有的基于 Eclipse 的 Android 项目导入到 Android Studio 中。一路走来,我解决了几个问题,我解决了最后一个问题(希望如此): Execution failed
错误描述: Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. > com.android.b
这是我的 full code ,当我使用“运行/调试配置 > Android 测试”运行以下代码时 class KernelTest extends Specification { def "
我正在尝试将 Google Plus 集成到我的应用程序中,但它显示了以下错误。下面是异常和gradle 错误:任务 ':app:transformClassesWithDexForDebug' 执行
我是一名优秀的程序员,十分优秀!