android - Gradle build hanging when jackOptions is enabled for Java 1.8 -
i want use lambdas in project decided switch java 1.8. android studio (2.1.3) forced me enable jackoptions. did install java 1.8 on mac , when run javac -version in terminal javac 1.8.0_101 , jdk in android studio points right one.
when try build project, gradle gets stuck on: :app:compiledebugjavawithjack
i did following , nothing worked:
- gradlew clean
- git clean -fdx , reimport project
- gradlew --stacktrace assemble
if revert java 1.7 lose lambdas feature project builds properly.
any ideas problem?
update
ok after waiting more 5 minutes gradle did spit following error:
error: dex writing phase: classes.dex has many ids. try using multi-dex com.android.jack.api.v01.compilationexception: dex writing phase: classes.dex has many ids. try using multi-dex @ com.android.jack.api.v01.impl.api01configimpl$api01compilationtaskimpl.run(api01configimpl.java:113) @ com.android.builder.core.androidbuilder.convertbytecodeusingjackapis(androidbuilder.java:1852) @ com.android.builder.core.androidbuilder.convertbytecodeusingjack(androidbuilder.java:1679) @ com.android.build.gradle.internal.transforms.jacktransform.runjack(jacktransform.java:221) @ com.android.build.gradle.internal.transforms.jacktransform.transform(jacktransform.java:195) @ com.android.build.gradle.internal.pipeline.transformtask$2.call(transformtask.java:178) @ com.android.build.gradle.internal.pipeline.transformtask$2.call(transformtask.java:174) @ com.android.builder.profile.threadrecorder.record(threadrecorder.java:156) @ com.android.build.gradle.internal.pipeline.transformtask.transform(transformtask.java:173) @ sun.reflect.generatedmethodaccessor412.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:498) @ org.gradle.internal.reflect.javamethod.invoke(javamethod.java:75) @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$incrementaltaskaction.doexecute(annotationprocessingtaskfactory.java:245) @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$standardtaskaction.execute(annotationprocessingtaskfactory.java:221) @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$incrementaltaskaction.execute(annotationprocessingtaskfactory.java:232) @ org.gradle.api.internal.project.taskfactory.annotationprocessingtaskfactory$standardtaskaction.execute(annotationprocessingtaskfactory.java:210) @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeaction(executeactionstaskexecuter.java:80) @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.executeactions(executeactionstaskexecuter.java:61) @ org.gradle.api.internal.tasks.execution.executeactionstaskexecuter.execute(executeactionstaskexecuter.java:46) @ org.gradle.api.internal.tasks.execution.postexecutionanalysistaskexecuter.execute(postexecutionanalysistaskexecuter.java:35) @ org.gradle.api.internal.tasks.execution.skipuptodatetaskexecuter.execute(skipuptodatetaskexecuter.java:66) @ org.gradle.api.internal.tasks.execution.validatingtaskexecuter.execute(validatingtaskexecuter.java:58) @ org.gradle.api.internal.tasks.execution.skipemptysourcefilestaskexecuter.execute(skipemptysourcefilestaskexecuter.java:52) @ org.gradle.api.internal.tasks.execution.skiptaskwithnoactionsexecuter.execute(skiptaskwithnoactionsexecuter.java:52) @ org.gradle.api.internal.tasks.execution.skiponlyiftaskexecuter.execute(skiponlyiftaskexecuter.java:53) @ org.gradle.api.internal.tasks.execution.executeatmostoncetaskexecuter.execute(executeatmostoncetaskexecuter.java:43) @ org.gradle.execution.taskgraph.defaulttaskgraphexecuter$eventfiringtaskworker.execute(defaulttaskgraphexecuter.java:203) @ org.gradle.execution.taskgraph.defaulttaskgraphexecuter$eventfiringtaskworker.execute(defaulttaskgraphexecuter.java:185) @ org.gradle.execution.taskgraph.abstracttaskplanexecutor$taskexecutorworker.processtask(abstracttaskplanexecutor.java:66) @ org.gradle.execution.taskgraph.abstracttaskplanexecutor$taskexecutorworker.run(abstracttaskplanexecutor.java:50) @ org.gradle.internal.concurrent.executorpolicy$catchandrecordfailures.onexecute(executorpolicy.java:54) @ org.gradle.internal.concurrent.stoppableexecutorimpl$1.run(stoppableexecutorimpl.java:40) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: com.android.jack.jackabortexception: dex writing phase: classes.dex has many ids. try using multi-dex @ com.android.jack.backend.dex.dexfilewriter.run(dexfilewriter.java:90) @ com.android.jack.backend.dex.dexfilewriter.run(dexfilewriter.java:41) @ com.android.sched.scheduler.scheduleinstance.runwithlog(scheduleinstance.java:203) @ com.android.sched.scheduler.multiworkersscheduleinstance$sequentialtask.process(multiworkersscheduleinstance.java:466) @ com.android.sched.scheduler.multiworkersscheduleinstance$worker.run(multiworkersscheduleinstance.java:163) caused by: com.android.jack.backend.dex.dexwritingexception: dex writing phase: classes.dex has many ids. try using multi-dex @ com.android.jack.backend.dex.singledexwritingtool.write(singledexwritingtool.java:59) @ com.android.jack.backend.dex.dexfilewriter.run(dexfilewriter.java:87) ... 4 more caused by: com.android.jack.backend.dex.singledexoverflowexception: classes.dex has many ids. try using multi-dex ... 6 more caused by: com.android.jack.tools.merger.methodidoverflowexception: method id overflow when trying merge dex files @ com.android.jack.tools.merger.constantmanager.adddexfile(constantmanager.java:177) @ com.android.jack.tools.merger.jackmerger.adddexfile(jackmerger.java:69) @ com.android.jack.backend.dex.dexwritingtool.mergedex(dexwritingtool.java:149) @ com.android.jack.backend.dex.singledexwritingtool.write(singledexwritingtool.java:57) ... 5 more :app:transformjackwithjackfortabletsdebug failed failure: build failed exception. * went wrong: execution failed task ':app:transformjackwithjackfortabletsdebug'. > com.android.build.api.transform.transformexception: com.android.jack.api.v01.compilationexception: dex writing phase: classes.dex has many ids. try using multi-dex
so did turn on multidex , got stuck on building 96% > :app:transformjackwithjackfortabletsdebug
i solved add line app/build.gradle multidexenabled = true below
android{ ... compilesdkversion rootproject.compileversion buildtoolsversion rootproject.buildtoolsversion defaultconfig { multidexenabled true } ... }
and in project build.gradle
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.2' } } allprojects { repositories { jcenter() } } ext { buildtoolsversion = "24.0.3" supportlibversion = "24.2.1" }
Comments
Post a Comment