From e5e29ead9ab28944aa137150aea23cdac120e5bf Mon Sep 17 00:00:00 2001 From: xuexiangjys Date: Sun, 25 Oct 2020 18:34:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=B4=E6=98=8E=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 23 +++++++++------- docs/README.md | 51 +++++++++++++++++++++++++++++++----- xaop-annotation/build.gradle | 6 ++--- xaop-plugin/build.gradle | 4 +-- 4 files changed, 63 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index efe004c..c78737e 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ ## 1、演示(请star支持) -![](https://github.com/xuexiangjys/XAOP/blob/master/img/aop.gif) +![aop.gif](https://img.rruu.net/image/5f9551baed9a7) ## 2、如何使用 目前支持主流开发工具AndroidStudio的使用,直接配置build.gradle,增加依赖即可. @@ -69,7 +69,7 @@ buildscript { ··· dependencies { ··· - classpath 'com.github.xuexiangjys.XAOP:xaop-plugin:1.0.5' + classpath 'com.github.xuexiangjys.XAOP:xaop-plugin:1.1.0' } } ``` @@ -81,13 +81,14 @@ apply plugin: 'com.xuexiang.xaop' //引用xaop插件 dependencies { ··· - //添加依赖 + //如果是androidx项目,使用1.1.0版本及以上 + implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.1.0' + //如果是support项目,请使用1.0.5版本 implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.0.5' - //如果你升级到androidx,请使用下面依赖 - implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.0.5x' } ``` + 4.在Application中进行初始化 ``` @@ -146,7 +147,7 @@ buildscript { ··· dependencies { ··· - classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4' + classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10' } } ``` @@ -156,6 +157,10 @@ buildscript { ``` apply plugin: 'android-aspectjx' //引用aspectjx插件 +aspectjx { + include '项目的applicationId' +} + ``` 详细使用可参见kotlin-test项目进行使用. @@ -342,10 +347,8 @@ private String hello(String name, String cardId) { > 你的打赏是我维护的动力,我将会列出所有打赏人员的清单在下方作为凭证,打赏前请留下打赏项目的备注! -![](https://github.com/xuexiangjys/Resource/blob/master/img/pay/alipay.jpeg)   ![](https://github.com/xuexiangjys/Resource/blob/master/img/pay/weixinpay.jpeg) +![pay.png](https://img.rruu.net/image/5f871d00045da) ## 联系方式 -[![](https://img.shields.io/badge/点击一键加入QQ群-602082750-blue.svg)](http://shang.qq.com/wpa/qunwpa?idkey=9922861ef85c19f1575aecea0e8680f60d9386080a97ed310c971ae074998887) - -![](https://github.com/xuexiangjys/XPage/blob/master/img/qq_group.jpg) +![gzh_weixin.jpg](https://img.rruu.net/image/5f871cfff3194) diff --git a/docs/README.md b/docs/README.md index f77f4c3..2c2c47c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -49,7 +49,7 @@ buildscript { ··· dependencies { ··· - classpath 'com.github.xuexiangjys.XAOP:xaop-plugin:1.0.5' + classpath 'com.github.xuexiangjys.XAOP:xaop-plugin:1.1.0' } } ``` @@ -61,9 +61,10 @@ apply plugin: 'com.xuexiang.xaop' //引用xaop插件 dependencies { ··· - implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.0.5' //添加依赖 - //如果你升级到androidx,请使用下面依赖 - implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.0.5x' + //如果是androidx项目,使用1.1.0版本及以上 + implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.1.0' + //如果是support项目,请使用1.0.5版本 + implementation 'com.github.xuexiangjys.XAOP:xaop-runtime:1.0.5' } ``` @@ -102,9 +103,47 @@ XAOP.setInterceptor(new Interceptor() { } }); +//设置自动捕获异常的处理者 +XAOP.setIThrowableHandler(new IThrowableHandler() { + @Override + public Object handleThrowable(String flag, Throwable throwable) { + XLogger.d("捕获到异常,异常的flag:" + flag); + if (flag.equals(TRY_CATCH_KEY)) { + return 100; + } + return null; + } +}); + ``` -## 联系方式 +## 兼容Kotlin语法配置 + +1.在项目根目录的 build.gradle 的 dependencies 添加aspectjx插件: -[![](https://img.shields.io/badge/点击一键加入QQ群-602082750-blue.svg)](http://shang.qq.com/wpa/qunwpa?idkey=9922861ef85c19f1575aecea0e8680f60d9386080a97ed310c971ae074998887) +``` +buildscript { + ··· + dependencies { + ··· + classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10' + } +} +``` + +2.在项目的 build.gradle 中增加依赖并引用aspectjx插件 + +``` +apply plugin: 'android-aspectjx' //引用aspectjx插件 + +aspectjx { + include '项目的applicationId' +} + +``` + +详细使用可参见kotlin-test项目进行使用. + +## 联系方式 +![gzh_weixin.jpg](https://img.rruu.net/image/5f871cfff3194) diff --git a/xaop-annotation/build.gradle b/xaop-annotation/build.gradle index 63336de..d2eef0b 100644 --- a/xaop-annotation/build.gradle +++ b/xaop-annotation/build.gradle @@ -10,8 +10,8 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } lintOptions { @@ -22,7 +22,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - compileOnly deps.support.app_compat + compileOnly deps.androidx.appcompat } apply from: "../JitPackUpload.gradle" diff --git a/xaop-plugin/build.gradle b/xaop-plugin/build.gradle index e041663..a44f0e8 100644 --- a/xaop-plugin/build.gradle +++ b/xaop-plugin/build.gradle @@ -16,8 +16,8 @@ apply plugin: 'groovy' -targetCompatibility = JavaVersion.VERSION_1_7 -sourceCompatibility = JavaVersion.VERSION_1_7 +targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_1_8 dependencies { implementation gradleApi()//gradle sdk