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

原作者已不再维护,继续使用建议使用我fork后修复发布的版本。(给即将使用或已经使用的几点建议) #332

Open
wurensen opened this issue Sep 29, 2021 · 18 comments

Comments

@wurensen
Copy link

wurensen commented Sep 29, 2021

1.首先一定要有自己fork修改的能力!!!
2.多变种构建问题(时长暴增,几个小时都有可能,因为后执行的变种会执行已执行变种的任务,bug)
3.多线程构建问题(aspectjtools多线程运行有问题)
4.测试时候请依赖1000个jar文件来测试(才会更容易暴露问题),因为aspectjtools.jar内的ClasspathJar限定了打开的依赖jar最大个数为1000,超过就会关掉10%,多线程下可能就导致异常
5.采用Kotlin语言编写,enabled设置为false或者不需要进行任何织入,会发生类丢失问题
6.做好研究aspectjtools.jar的准备

以上问题已经解决并发布相关版本,同时也已经支持gradle 7.x版本,有相关疑问请移步到 https://github.com/wurensen/gradle_plugin_android_aspectjx 提相关issue。

@wurensen
Copy link
Author

补充:发生异常不会中断构建

@spysoos
Copy link

spysoos commented Oct 3, 2021

请问 你修改的版本支持到 android gradle plugin 4.0.0吗?

@wurensen
Copy link
Author

wurensen commented Oct 8, 2021

请问 你修改的版本支持到 android gradle plugin 4.0.0吗?

@spysoos 2.0.10本来就有支持4.0.0啊,我项目用的是4.1.3,更高版本是否支持有待验证。你用的agp是什么版本?报什么错误?

@wurensen
Copy link
Author

wurensen commented Oct 9, 2021

我已经fork来改,并修复相关问题,有兴趣的关注:https://github.com/wurensen/gradle_plugin_android_aspectjx
目前已发布测试版本到maven仓库,注意插件地址引用需要修改为:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    // snapshots仓库地址
    maven {
        url "https://s01.oss.sonatype.org/content/repositories/snapshots/"
    }

    dependencies {
        // aspectj插件
        classpath 'io.github.wurensen:gradle-android-plugin-aspectjx:2.0.11-SNAPSHOT'
    }
}

注意该版本是测试版本,有任何问题及时和我联系。

@wurensen wurensen changed the title 给即将使用或已经使用的几点建议 原作者已不再维护,继续使用建议使用我fork后修复发布的版本。(给即将使用或已经使用的几点建议) Oct 9, 2021
@wurensen
Copy link
Author

我已经fork来改,并修复相关问题,有兴趣的关注:https://github.com/wurensen/gradle_plugin_android_aspectjx 目前已发布测试版本到maven仓库,注意插件地址引用需要修改为:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    // snapshots仓库地址
    maven {
        url "https://s01.oss.sonatype.org/content/repositories/snapshots/"
    }

    dependencies {
        // aspectj插件
        classpath 'io.github.wurensen:gradle-android-plugin-aspectjx:2.0.11-SNAPSHOT'
    }
}

注意该版本是测试版本,有任何问题及时和我联系。

已发布正式版本到maven仓库:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    // maven仓库
    mavenCentral()

    dependencies {
        // aspectj插件
        classpath 'io.github.wurensen:gradle-android-plugin-aspectjx:2.0.11'
    }
}

@leeyushi
Copy link

leeyushi commented Jan 4, 2022

支持kotlin1.5+吗

@wurensen
Copy link
Author

@leeyushi 一直都支持,但需要去配置exclude掉一些kotlin相关的包

@brandlee
Copy link

brandlee commented Sep 1, 2022

@wurensen w 在使用Android Gradle Plugin 7.2.2的时候,项目报错:
`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`

@wurensen
Copy link
Author

wurensen commented Sep 1, 2022

@wurensen w 在使用Android Gradle Plugin 7.2.2的时候,项目报错: `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`

@brandlee 你是用plugins的方式引入的吗?因为插件并没有发布到gradle plugin portal仓库中,所以需要自己修改插件的解析规则(settings.gradle文件中):

pluginManagement {
    resolutionStrategy {
        // 定义id和插件库映射关系
        def modules = [
                'android-aspectjx'       : 'io.github.wurensen:gradle-android-plugin-aspectjx:2.0.15',
        ]
        eachPlugin {
            println "id=" + requested.id.id
            def module = modules.get(requested.id.id)
            if (module != null) {
                useModule(module)
            }
        }
    }
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

@brandlee
Copy link

brandlee commented Sep 1, 2022

@wurensen w 在使用Android Gradle Plugin 7.2.2的时候,项目报错: `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`

@brandlee 你是用plugins的方式引入的吗?因为插件并没有发布到gradle plugin portal仓库中,所以需要自己修改插件的解析规则:

pluginManagement {
    resolutionStrategy {
        // 定义id和插件库映射关系
        def modules = [
                'android-aspectjx'       : 'io.github.wurensen:gradle-android-plugin-aspectjx:2.1.0-SNAPSHOT',
        ]
        eachPlugin {
            println "id=" + requested.id.id
            def module = modules.get(requested.id.id)
            if (module != null) {
                useModule(module)
            }
        }
    }
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

对的,我是直接使用plugin方式引入的。
plugins { id "android-aspectjx" }

@wurensen
Copy link
Author

wurensen commented Sep 1, 2022

@brandlee 那你先用我说的自定义解析插件id的方式,该解决方案适用于所有未发布到gradle官方仓库的插件。

@brandlee
Copy link

brandlee commented Sep 1, 2022

@wurensen 没太理解这个是怎么修改的,能详细一点儿么?感激

@wurensen
Copy link
Author

wurensen commented Sep 1, 2022

@brandlee 你使用plugins,在settings.gradle文件不是有插件管理配置吗?在settings.gradle的pluginManagement{}中添加resolutionStrategy规则

@brandlee
Copy link

brandlee commented Sep 1, 2022

@wurensen 在settings.gradle中添加了下面的代码,也还是报错了:
image
错误信息:
image

@wurensen
Copy link
Author

wurensen commented Sep 1, 2022

@brandlee 版本号改成2.0.15,2.1.0-SNAPSHOT是我发布到本地的,刚开始回答你忘了修改了。具体后续版本号关注我fork的项目:https://github.com/wurensen/gradle_plugin_android_aspectjx

@brandlee
Copy link

brandlee commented Sep 1, 2022

@wurensen 一样的问题
image

@wurensen
Copy link
Author

wurensen commented Sep 1, 2022

@brandlee 你AGP插件什么版本?我目前自测最高的版本是7.1.3,你先用7.1.3试试,还有问题到我项目提issue,不再这个issue进行讨论了。

@FlyJingFish
Copy link

推荐使用https://github.com/FlyJingFish/AndroidAOP

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

5 participants