Skip to content

java.lang.RuntimeException: Unexpected scopes found in folder #45

Closed
@xuegl

Description

@xuegl

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

baoxiehao commented on Jul 21, 2017

@baoxiehao

I came across the same problem.

added a commit that references this issue on Oct 13, 2017

Merge pull request #54 from coofee/compat-gradle-plugin-3.0.0

Object-Ping

Object-Ping commented on Oct 26, 2017

@Object-Ping

I came across the same problem.

Object-Ping

Object-Ping commented on Oct 26, 2017

@Object-Ping

I came across the same problem.

bpappin

bpappin commented on Nov 9, 2017

@bpappin

same problem in android studio

Tim1008

Tim1008 commented on Dec 1, 2017

@Tim1008

same problem in android studio

fatCat2015

fatCat2015 commented on Jan 2, 2018

@fatCat2015

I came across the same problem. as gradle 4.1,gradle plugin 3.0

vicctor

vicctor commented on Jan 15, 2018

@vicctor

Does anyone found solution for this?

Hommilist

Hommilist commented on Feb 12, 2018

@Hommilist

I came across the same problem.

ditclear

ditclear commented on Feb 26, 2018

@ditclear

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

arpitchoudhary commented on Mar 19, 2018

@arpitchoudhary

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

itsymbal commented on Mar 29, 2018

@itsymbal

arpitchoudhary's suggested solution works for me

Deemonser

Deemonser commented on Apr 4, 2018

@Deemonser

yes, arpitchoudhary's suggested solution works for me

Nullifier1571

Nullifier1571 commented on Apr 20, 2018

@Nullifier1571

try to close instant run

crobinson42

crobinson42 commented on Jul 26, 2018

@crobinson42

@Nullifier1571 suggestion led me to a solution

try to close instant run
I couldn't figure out how to close instant run so I restarted the emulator and my build ran fine.

ameerhamza6733

ameerhamza6733 commented on Aug 18, 2018

@ameerhamza6733

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

AXwjg commented on Aug 27, 2018

@AXwjg

The way I handle it is to uncheck all the contents in Instant Run in Android Studio Settings.

naimishvinchhi

naimishvinchhi commented on Oct 23, 2018

@naimishvinchhi

Clean and run works for me.

sinameraji

sinameraji commented on Dec 4, 2018

@sinameraji

I just clicked "build" project and it fixed the issue

staticvoidjames

staticvoidjames commented on Jan 9, 2019

@staticvoidjames

try to close instant run

that works for me

tsingthu

tsingthu commented on Jan 10, 2019

@tsingthu

I tried as arpitchoudhary suggested, and it works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @vicctor@itsymbal@xuegl@firefly1126@bpappin

        Issue actions

          java.lang.RuntimeException: Unexpected scopes found in folder · Issue #45 · HujiangTechnology/gradle_plugin_android_aspectjx