Android Studio Building Ubuntu Return code 1 for dex process

#1

Help, all my time has the same problem (we think that an Java Update Cause it)
Someone is passing throw this error?

Some forums tell us to update Gradle, but react-native projects can’t run with new gradle versions.

Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
Message{kind=ERROR, text=Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add 
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file., sources=[Unknown source file], original message=UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
	at com.android.dx.command.dexer.Main.processClass(Main.java:781)
	at com.android.dx.command.dexer.Main.processFileBytes(Main.java:747)
	at com.android.dx.command.dexer.Main.access$1200(Main.java:88)
	at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1689)
	at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
	at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
	at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
	at com.android.dx.command.dexer.Main.processOne(Main.java:695)
	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:592)
	at com.android.dx.command.dexer.Main.runMultiDex(Main.java:376)
	at com.android.dx.command.dexer.Main.run(Main.java:290)
	at com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)
	at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:174)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	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: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
	at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:476)
	at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
	at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
	at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
	at com.android.dx.command.dexer.Main.parseClass(Main.java:793)
	at com.android.dx.command.dexer.Main.access$1600(Main.java:88)
	at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1728)
	at com.android.dx.command.dexer.Main.processClass(Main.java:779)
	... 16 more
, tool name=Optional.of(Dex)}
1 error; aborting
Message{kind=ERROR, text=1 error; aborting, sources=[Unknown source file]}
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithDexForDevDebug'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
	at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
	at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
	at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)
	at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
	at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)
	at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
	at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
	at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
	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.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex '/home/victorwads/.android/build-cache/16f77f49aa84d13f3edea9a2fdb66fc9ed7ec606/output/jars/classes.jar' to '/home/victorwads/GitRepos/ecocardmobile/android/app/build/intermediates/transforms/dex/dev/debug/folders/1000/10/classes_0c98f0f33a893910d3c484a93e139b2a812e2a8c'
	at com.android.builder.profile.Recorder$Block.handleException(Recorder.java:55)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:104)
	at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:176)
	at sun.reflect.GeneratedMethodAccessor755.invoke(Unknown Source)
	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:73)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:163)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
	at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
	... 23 more
Caused by: com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex '/home/victorwads/.android/build-cache/16f77f49aa84d13f3edea9a2fdb66fc9ed7ec606/output/jars/classes.jar' to '/home/victorwads/GitRepos/ecocardmobile/android/app/build/intermediates/transforms/dex/dev/debug/folders/1000/10/classes_0c98f0f33a893910d3c484a93e139b2a812e2a8c'
	at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:453)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:185)
	at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:181)
	at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
	... 33 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex '/home/victorwads/.android/build-cache/16f77f49aa84d13f3edea9a2fdb66fc9ed7ec606/output/jars/classes.jar' to '/home/victorwads/GitRepos/ecocardmobile/android/app/build/intermediates/transforms/dex/dev/debug/folders/1000/10/classes_0c98f0f33a893910d3c484a93e139b2a812e2a8c'
	at com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:147)
	at com.android.build.gradle.internal.transforms.DexTransform.transform(DexTransform.java:408)
	... 36 more
Caused by: java.lang.RuntimeException: Unable to pre-dex '/home/victorwads/.android/build-cache/16f77f49aa84d13f3edea9a2fdb66fc9ed7ec606/output/jars/classes.jar' to '/home/victorwads/GitRepos/ecocardmobile/android/app/build/intermediates/transforms/dex/dev/debug/folders/1000/10/classes_0c98f0f33a893910d3c484a93e139b2a812e2a8c'
	at com.android.build.gradle.internal.transforms.DexTransform$PreDexTask.call(DexTransform.java:521)
	at com.android.build.gradle.internal.transforms.DexTransform$PreDexTask.call(DexTransform.java:457)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	... 3 more
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.utils.FileCache$FileCreatorException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
	at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:680)
	at com.android.builder.utils.FileCache.doLocked(FileCache.java:639)
	at com.android.builder.utils.FileCache.queryCacheEntry(FileCache.java:395)
	at com.android.builder.utils.FileCache.createFile(FileCache.java:290)
	at com.android.build.gradle.internal.transforms.DexTransform$PreDexTask.call(DexTransform.java:518)
	... 7 more
Caused by: java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.utils.FileCache$FileCreatorException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
	at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:680)
	at com.android.builder.utils.FileCache.doLocked(FileCache.java:639)
	at com.android.builder.utils.FileCache.lambda$queryCacheEntry$10(FileCache.java:419)
	at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:678)
	... 11 more
Caused by: java.util.concurrent.ExecutionException: com.android.builder.utils.FileCache$FileCreatorException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
	at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:680)
	at com.android.builder.utils.FileCache.doLocked(FileCache.java:639)
	at com.android.builder.utils.FileCache.lambda$createFile$5(FileCache.java:282)
	at com.android.builder.utils.FileCache.lambda$null$9(FileCache.java:440)
	at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:678)
	... 14 more
Caused by: com.android.builder.utils.FileCache$FileCreatorException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
	at com.android.builder.utils.FileCache.lambda$createFile$0(FileCache.java:241)
	at com.android.builder.utils.FileCache.lambda$null$4(FileCache.java:285)
	at com.android.builder.utils.FileCache.doInterProcessLocked(FileCache.java:678)
	... 18 more
Caused by: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
	at com.android.builder.core.DexByteCodeConverter.dexInProcess(DexByteCodeConverter.java:180)
	at com.android.builder.core.DexByteCodeConverter.runDexer(DexByteCodeConverter.java:158)
	at com.android.builder.core.AndroidBuilder.preDexLibraryNoCache(AndroidBuilder.java:1464)
	at com.android.builder.internal.compiler.PreDexCache.preDexLibrary(PreDexCache.java:129)
	at com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1415)
	at com.android.build.gradle.internal.transforms.DexTransform$PreDexTask.lambda$call$0(DexTransform.java:503)
	at com.android.builder.utils.FileCache.lambda$createFile$0(FileCache.java:239)
	... 20 more
Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at com.android.builder.core.DexByteCodeConverter.dexInProcess(DexByteCodeConverter.java:178)
	... 26 more
Caused by: com.android.ide.common.process.ProcessException: Return code 1 for dex process
	at com.android.builder.internal.compiler.DexWrapper$DexProcessResult.assertNormalExitValue(DexWrapper.java:117)
	at com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:175)
	... 4 more
1 Like
#2

This post have the same issue

1 Like
#3

The solution was posted in that thread: Android Standalone build failed

1 Like
#4

Thank U @jesse

1 Like
closed #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.