wurensen / gradle_plugin_android_aspectjx

A Android gradle plugin that effects AspectJ on Android project and can hook methods in Kotlin, aar and jar file.
Apache License 2.0
363 stars 50 forks source link

提示:Transforms with scopes '[SUB_PROJECTS, EXTERNAL_LIBRARIES]' cannot be applied to library projects. #34

Closed gnmmdk closed 2 years ago

gnmmdk commented 2 years ago

image

wurensen commented 2 years ago

@gnmmdk 你是在library模块引入的吗?可以先改到app模块试试

gnmmdk commented 2 years ago

是的,不行啊,我们项目library都需要引入。

keekkenen commented 2 years ago

why 3.1.0 version doesn't work with library ? apply plugin: 'com.android.library' apply plugin: 'io.github.wurensen.android-aspectjx'

keekkenen commented 2 years ago

why 3.1.0 version doesn't work with library ? apply plugin: 'com.android.library' apply plugin: 'io.github.wurensen.android-aspectjx'

mm.. I understood, plugin see all libraries (libs like a subprojects - like as part of application) through app and apply aspects for it

wurensen commented 2 years ago

@gnmmdk 能描述以下你们使用的场景吗?是app和library都需要分别引入该插件吗?

wurensen commented 2 years ago

相同问题:#30

gnmmdk commented 2 years ago

distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip

classpath 'com.android.tools.build:gradle:7.2.2'

这是我的环境,并且application和library都有使用

wurensen commented 2 years ago

@gnmmdk 你们application和library分别都引入插件,是期望application处理所有class,library只处理自己模块的class(library也无法处理第三方依赖类)是吗? 也就是说,'Aspect注解'声明的织入类,只有在该类对应的app/module有引入到该插件才产生作用,对于在module中声明了'Aspect注解'类,但只在app module引入该插件,那这种情况下该织入类就不生效了。 总结就是:织入类的作用范围和引入插件的模块是一致的。 按照以上说明的方式来修改,是符合使用者预期的吧?

wurensen commented 2 years ago

why 3.1.0 version doesn't work with library ? apply plugin: 'com.android.library' apply plugin: 'io.github.wurensen.android-aspectjx'

mm.. I understood, plugin see all libraries (libs like a subprojects - like as part of application) through app and apply aspects for it

@keekkenen I'm sorry about that working library with error right now. I need to confirm the scope of the class with 'Aspect annotation' when 'application' and 'library' apply the plugin at the same time.

wurensen commented 2 years ago

duplicate #30

gnmmdk commented 2 years ago

以前使用 HujiangTechnology/gradle_plugin_android_aspectjx,模块是支持使用的,现在升级gradle,所以只能使用到你这个。我们的项目不希望去更改用法。