Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle 3.0 虽然编译成功但是切面不生效 #61

Closed
ganyao114 opened this issue Nov 9, 2017 · 15 comments
Closed

gradle 3.0 虽然编译成功但是切面不生效 #61

ganyao114 opened this issue Nov 9, 2017 · 15 comments

Comments

@ganyao114
Copy link

使用最新的 1.1.0 gradle 依赖方式

@ganyao114
Copy link
Author

there is no aspectjrt dependencies in classpath, do nothing
directoryInput = c2e04b900cc76985149afb9c020b826b12f143b4
jarInput = :common
jarInput = :libs
有 log

@ganyao114
Copy link
Author

相同的代码 gradle 2.3.3 是可以的,升级之后就不行了

@ganyao114
Copy link
Author

已知原因:
现在的版本仍然不支持 gradle 3.0 的 Desugar(默认实现 java8 特性) 插件
手动配置 android.enableDesugar=false ,重新启用 retrolambda 插件实现 java8 即可切入成功

@BigTimo
Copy link

BigTimo commented Nov 16, 2017

使用Gradle3.0 ,在gradle.properties配置android.enableDesugar=false,报错会提示你设置enableDesugar=true,这个如何设置

@ganyao114
Copy link
Author

@BigTimo 上面说过用 retrolambda 插件,或者你不用 java8 直接设置 java 版本为 1.7 就可以了

@VinaChiong
Copy link

@ganyao114
我disable了 desugar,并设置 compileOptions的source和target为1.7,依然报

Error:Execution failed for task ':app_enterprise:transformClassesWithAspectTransformForFtsp_enterpriseDebug'.

Unexpected scopes found in folder '{app module目录路径}/build/intermediates/transforms/AspectTransform/{app module名}/debug'. Required: PROJECT, EXTERNAL_LIBRARIES, SUB_PROJECTS. Found: EXTERNAL_LIBRARIES, PROJECT, PROJECT_LOCAL_DEPS, SUB_PROJECTS, SUB_PROJECTS_LOCAL_DEPS

@islamassi
Copy link

I'm facing the same issue that @ganyao114 mentioned.

@TYUpya
Copy link

TYUpya commented Nov 30, 2017

@ganyao114 我按照你的说的方法 {
手动配置 android.enableDesugar=false ,重新启用 retrolambda 插件实现 java8 即可切入成功
} 试了下,但是编译会报错。
请问有没有具体的Demo可以参考呢?
请问"gradle_plugin_android_aspectjx" 什么时候才能支持java1.8呢?
我现在Android Studio是3.0.1版本 Gradle插件是3.0.1,Gradle是4.1。现在项目急需要用到AOP,如果后续版本还是不能适配Java1.8,那我就只能采用埋点的方式了。

@diov
Copy link

diov commented Dec 12, 2017

今天反编译了一下发现能够编译通过,但是切片没有生效。
希望能够给一个大致的 release 时间吧,毕竟不论是 Gradle 4.1还是 Java 8 都有很多值得使用的新特性。

@firefly1126
Copy link
Contributor

最近release的1.1.1版本解决了Java8的支持问题,但是这个版本如果用Java8编译,includeJarFiter, excludeJarFilter这两个过滤配置失效,配置问题会在下个版本修复。

@ganyao114
Copy link
Author

@firefly1126 继续努力

@xiayifeng
Copy link

我设置了android.enableDesugar=false,编译成功了,但是切片还是没有生效

@firefly1126
Copy link
Contributor

2.0.0做了重大调整,有更好的编译效率和稳定性,该版本做了如下调整:

  • 支持Instant Run编译
  • 废弃 includeJarFilter和excludeJarFilter两个配置命令
  • 新增 include和 exclude配置命令,通过包名(package)路径关键字匹配,可过滤class文件和库文件(jar)
  • include和 exclude配置命令支持*,**通配符
  • 修复已知的gradle兼容性Bug
  • 提升编译效率
  • 解决 Could not find matching constructor for: org.gradle.util.Clock()

@tedzyc
Copy link

tedzyc commented Sep 3, 2018

@firefly1126 androidstudio3.0什么时候能支持?都观望半年了
总不能为了用aop而用回老版本AS,削足适履啊

@xiayifeng
Copy link

@tedzyc 我修改了一下他的groovy,现在可以用了, 只要改下里面的timer部分就行了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants