Skip to content

Commit f2f8ca8

Browse files
committed
添加VasDolly多渠道打包
1 parent 43b8db6 commit f2f8ca8

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

app/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44
apply plugin: 'kotlin-kapt'
5+
apply plugin: 'android-aspectjx'
56
apply from: '../channel.gradle'
67
apply from: '../protect.gradle'
78
apply from: '../uploadpgy.gradle'
89

10+
aspectjx {
11+
//排除所有特定class文件
12+
exclude 'module-info', 'kotlinx.coroutines', 'androidx.paging', 'com.lxj.xpopup', 'com.just.agentweb'
13+
}
14+
915
kapt {
1016
generateStubs = true
1117
}
@@ -125,6 +131,9 @@ dependencies {
125131
implementation 'com.tencent.bugly:crashreport:3.2.33'
126132
implementation project(path: ':LaunchStarter')
127133

134+
//aspectj
135+
implementation 'org.aspectj:aspectjrt:1.9.5'//需要使用aspectJ能力的模块
136+
128137
//flutter
129138
implementation project(':flutter')
130139

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.fmt.github.aspectj
2+
3+
import android.util.Log
4+
import org.aspectj.lang.ProceedingJoinPoint
5+
import org.aspectj.lang.annotation.Around
6+
import org.aspectj.lang.annotation.Aspect
7+
8+
/**
9+
* 使用AspectJ Aop实现方法耗时的统计
10+
* //拓展:权限校验、重复点击、埋点统计、权限校验、日志记录等
11+
*/
12+
@Aspect
13+
class AspectJHandle {
14+
15+
private val TAG = "AspectJHandle"
16+
17+
@Around("execution(@com.fmt.github.aspectj.MethodTrace * *(..))")
18+
@Throws(Throwable::class)
19+
fun methodTrace(joinPoint: ProceedingJoinPoint) {
20+
val signature = joinPoint.signature
21+
//获取所在的类名
22+
val className = signature.declaringType.canonicalName
23+
//获取注解的方法名称
24+
val methodName = signature.name
25+
26+
val startTime = System.currentTimeMillis()
27+
joinPoint.proceed()
28+
Log.e(TAG, "$className:$methodName cost=${(System.currentTimeMillis() - startTime)}")
29+
}
30+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.fmt.github.aspectj
2+
3+
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR)
4+
@Retention(AnnotationRetention.RUNTIME)
5+
annotation class MethodTrace

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ buildscript {
66
repositories {
77
google()
88
jcenter()
9-
9+
1010
}
1111
dependencies {
1212
classpath 'com.android.tools.build:gradle:3.4.2'
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
classpath 'com.leon.channel:plugin:2.0.3'
15+
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10'
1516
}
1617
}
1718

0 commit comments

Comments
 (0)