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

不支持Gradle 7.3.3 + AGP 7.2.0版本 #23

Closed po1xiao closed 2 years ago

po1xiao commented 2 years ago

AS版本: Android Studio Chipmunk | 2021.2.1 Build #AI-212.5712.43.2112.8512546, built on April 29, 2022

错误详情: An exception occurred applying plugin request [id: 'android-aspectjx']

Failed to apply plugin 'android-aspectjx'. No such property: FD_INTERMEDIATES for class: com.android.builder.model.AndroidProject

image

keekkenen commented 2 years ago

yes, I've it problem too

keekkenen commented 2 years ago

In new AGP FD_INTERMEDIATES constant was deleted from AndroidProject and now we have runtime error

canzu commented 2 years ago

same issue

keekkenen commented 2 years ago

for using aspects in our apps, I made local fork this plugin and removed FD_INTERMEDIATES constant and hard coded directory name by usage point.. also made optional print tasks work time, by default made it in disable mode, because too many task work time prints very annoy (espessialy in error case)

po1xiao commented 2 years ago

I didn't find any fork of this project in your reositories,could you give me a link of your fork if posible?

keekkenen commented 2 years ago

I didn't create fork on github, I fork it on my work machine only.. I'll create fork tomorow and write about it here

keekkenen commented 2 years ago

sorry for delay, I was realy busy.. I created fork in my repos, for compile jar you need comment last line with apply from: 'plugin_maven_publish.gradle' in build.gradle file from aspectjx subproject

po1xiao commented 2 years ago

sorry for delay, I was realy busy.. I created fork in my repos, for compile jar you need comment last line with apply from: 'plugin_maven_publish.gradle' in build.gradle file from aspectjx subproject

thanks a lot.

after adding compiled jar and 'org.aspectj:aspectjtools:1.9.6' to gradle classpath, it works for me too.

wurensen commented 2 years ago

you can try like this: https://github.com/wurensen/gradle_plugin_android_aspectjx/issues/13#issuecomment-1231272241

brandlee commented 2 years ago

@wurensen 我遇到的跟这位同学应该是同样的问题,我的agp版本是: classpath 'com.android.tools.build:gradle:7.2.2' distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip

wurensen commented 2 years ago

@brandlee 好的,可以的话先用7.1.3版本

brandlee commented 2 years ago

@wurensen 原因是这样的,我想升级使用Compose 1.2.1,配套的kotlin版本就要升级到1.7.1,同时compileSdkVersion需要升级到32,这样低版本的gradle就无法支持,所以我们就把agp从7.0.2升级到7.2.2

cloud-sunny commented 2 years ago

7.3.3看这里https://plugins.gradle.org/plugin/io.github.xiaoyun-sun.aspectjx

wurensen commented 2 years ago

@xiaoyun-sun agp7.2已经适配好了,所有代码也用kotlin重写了,现在正在弄发布到gradlePluginPortal。光适配没用,原插件bug比较多,我这边修复了大部分。

po1xiao commented 2 years ago

@xiaoyun-sun agp7.2已经适配好了,所有代码也用kotlin重写了,现在正在弄发布到gradlePluginPortal。光适配没用,原插件bug比较多,我这边修复了大部分。

赞,大佬们辛苦!

wurensen commented 2 years ago

@xiaoyun-sun 顺便问一下,发布到gradle官方仓库审核要多久?刚发布上去了,但也没说大概多久会审核。

brandlee commented 2 years ago

@wurensen 很厉害啊,我一直在觉得在项目中aspectj这块,由于对gradle和aspectj整体的不熟悉,代码其实不太可控,如果出了问题自己还不太会排查,有什么学习路径,可以分享一下的么?感谢

wurensen commented 2 years ago

@brandlee gradle本质是一个运行于java环境的构建工具,aspectj本身是一个jar工具包,作用就是处理你的class文件就是修改。关于gradle学习就是多去看官方文档,碰到问题就看文档、源码或者debug调试。毕竟是一个构建工具,深入到什么地步取决于自己业务的需求了。

wurensen commented 2 years ago

@canzu @keekkenen @brandlee @po1xiao agp7.2.2、gradle7.3.3已经适配。 请升级到3.0.0版本使用,插件id已变更为'io.github.wurensen.android-aspectjx'。

po1xiao commented 2 years ago

@canzu @keekkenen @brandlee @po1xiao agp7.2.2、gradle7.3.3已经适配。 请升级到3.0.0版本使用,插件id已变更为'io.github.wurensen.android-aspectjx'。

3.0.0版项目中验证未发现为题,@wurensen大佬可在适当时候关闭该isuue。