It's very weird.
It always works if I run it from the comnand line by gradlew assembleDebug
Then if I run it from the Android studio it also works, because predex is 
completed.
But when i choose "Rebuild project" and then "Run" 
I found that it is OK if I turn off parallel compile of modules 
I have one module which generate sqlite db to the assets in this way

tasks.getByPath(*":app:preBuild"*).dependsOn(*':tools-db-maker:prepareFolderDb'*)

So it should not have conflict with preDex

Here is whole stack trace:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task 
':app:preDexDebug'.

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:64)
at 
org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at 
org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
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.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305)
at 
org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at 
org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at 
org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at 
org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
Error:java.lang.RuntimeException: java.lang.IllegalStateException: Cannot 
call preDexLibrary() before setTargetInfo() is called.
at 
com.android.ide.common.internal.WaitableExecutor.waitForTasksWithQuickFail(WaitableExecutor.java:116)
at 
com.android.ide.common.internal.WaitableExecutor$waitForTasksWithQuickFail$0.call(Unknown
 
Source)
at com.android.build.gradle.tasks.PreDex.taskAction(PreDex.groovy:101)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at 
org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:235)
at 
org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at 
org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:222)
at 
org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at 
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at 
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 13 more
Error:java.lang.IllegalStateException: Cannot call preDexLibrary() before 
setTargetInfo() is called.
at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
at 
com.android.builder.core.AndroidBuilder.preDexLibrary(AndroidBuilder.java:1453)
at com.android.builder.core.AndroidBuilder$preDexLibrary$1.call(Unknown 
Source)
at com.android.build.gradle.tasks.PreDex$PreDexTask.call(PreDex.groovy:145)
at com.android.build.gradle.tasks.PreDex$PreDexTask.call(PreDex.groovy)


Dne středa, 5. listopadu 2014 17:48:08 UTC+1 Xavier Ducrohet napsal(a):
>
> I know what it means but this is very strange.
>
> Do you have a full stack trace? If not, can you try to compile from the 
> command line with --stacktrace?
>
> On Wed, Nov 5, 2014 at 8:05 AM, Tomáš Procházka <[email protected] 
> <javascript:>> wrote:
>
>> Do you know what this error mean?
>>
>> Error:Execution failed for task ':app:preDexDebug'.
>> > java.lang.IllegalStateException: Cannot call preDexLibrary() before 
>> setTargetInfo() is called.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "adt-dev" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.
> http://developer.android.com | http://tools.android.com
>
> Please do not send me questions directly. Thanks! 
>

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to