Description
Under android studio 3.0 & gradle 4.1 milestone, I encountered the compile error:
Caused by: java.lang.RuntimeException: Unexpected scopes found in folder '/app/build/intermediates/transforms/AspectTransform/debug'. Required: PROJECT, SUB_PROJECTS, EXTERNAL_LIBRARIES. Found: EXTERNAL_LIBRARIES, PROJECT, PROJECT_LOCAL_DEPS, SUB_PROJECTS, SUB_PROJECTS_LOCAL_DEPS at com.android.build.gradle.internal.pipeline.IntermediateFolderUtils.makeRestrictedCopies(IntermediateFolderUtils.java:455) at com.android.build.gradle.internal.pipeline.IntermediateFolderUtils.<init>(IntermediateFolderUtils.java:66) at com.android.build.gradle.internal.pipeline.IntermediateStream.init(IntermediateStream.java:191) at com.android.build.gradle.internal.pipeline.IntermediateStream.asNonIncrementalInput(IntermediateStream.java:146) at com.android.build.gradle.internal.pipeline.TransformTask.computeNonIncTransformInput(TransformTask.java:281) at com.android.build.gradle.internal.pipeline.TransformTask.access$500(TransformTask.java:70) at com.android.build.gradle.internal.pipeline.TransformTask$1.call(TransformTask.java:196) at com.android.build.gradle.internal.pipeline.TransformTask$1.call(TransformTask.java:157) at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102) at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:152) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:168) 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:121) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
I checked the build output dir, and there is a exactly a AspectTransform directory. maybe gradle considers it invalid?
I'm also working with hugo, and knows that our plugin works the same as hugo in the AspectJ part, so i made a compartion of source code between them.
the Hugo plugin is as follows:
JavaCompile javaCompile = variant.javaCompile javaCompile.doLast { String[] args = [ "-showWeaveInfo", "-1.5", "-inpath", javaCompile.destinationDir.toString(), "-aspectpath", javaCompile.classpath.asPath, "-d", javaCompile.destinationDir.toString(), "-classpath", javaCompile.classpath.asPath, "-bootclasspath", project.android.bootClasspath.join(File.pathSeparator) ] log.debug "ajc args: " + Arrays.toString(args) ......
and our plugin:
`def args = [
"-showWeaveInfo",
"-encoding", encoding,
"-source", sourceCompatibility,
"-target", targetCompatibility,
"-d", destinationDir,
"-classpath", classPath.join(File.pathSeparator),
"-bootclasspath", bootClassPath
]
if (!getInPath().isEmpty()) {
args << '-inpath'
args << getInPath().join(File.pathSeparator)
}
if (!getAspectPath().isEmpty()) {
args << '-aspectpath'
args << getAspectPath().join(File.pathSeparator)
}`
i doubt that the output dir differs, which caused gradle report this exception.
Activity
baoxiehao commentedon Jul 21, 2017
I came across the same problem.
Merge pull request #54 from coofee/compat-gradle-plugin-3.0.0
Object-Ping commentedon Oct 26, 2017
I came across the same problem.
Object-Ping commentedon Oct 26, 2017
I came across the same problem.
bpappin commentedon Nov 9, 2017
same problem in android studio
Tim1008 commentedon Dec 1, 2017
same problem in android studio
fatCat2015 commentedon Jan 2, 2018
I came across the same problem. as gradle 4.1,gradle plugin 3.0
vicctor commentedon Jan 15, 2018
Does anyone found solution for this?
Hommilist commentedon Feb 12, 2018
I came across the same problem.
ditclear commentedon Feb 26, 2018
using JAR from product. Make new directory named as plugins, and put product/gradle-android-plugin-aspectjx-1.1.1.jar in plugins, then do as below:
dependencies {
classpath fileTree(dir:'plugins', include:['*.jar'])
//don't lost dependency
classpath 'org.aspectj:aspectjtools:1.8.+'
}
arpitchoudhary commentedon Mar 19, 2018
I found a solution which works in my case.
I deleted the .gradle and .idle folder from the studio and then re-run the app.
it works fine for me
itsymbal commentedon Mar 29, 2018
arpitchoudhary's suggested solution works for me
Deemonser commentedon Apr 4, 2018
yes, arpitchoudhary's suggested solution works for me
Nullifier1571 commentedon Apr 20, 2018
try to close instant run
crobinson42 commentedon Jul 26, 2018
@Nullifier1571 suggestion led me to a solution
ameerhamza6733 commentedon Aug 18, 2018
try to close instant run or just unpluge your device from PC this is automatically stop instant run or turn of your virtual device
AXwjg commentedon Aug 27, 2018
The way I handle it is to uncheck all the contents in Instant Run in Android Studio Settings.
naimishvinchhi commentedon Oct 23, 2018
Clean and run works for me.
sinameraji commentedon Dec 4, 2018
I just clicked "build" project and it fixed the issue
staticvoidjames commentedon Jan 9, 2019
that works for me
tsingthu commentedon Jan 10, 2019
I tried as arpitchoudhary suggested, and it works for me.