我新建了一个Java空项目,没有编写aspectj语法,只是引入了依赖和插件,在只引入了apply plugin : 'android-aspectjx'插件时,它运行良好,在同时引入
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin : 'android-aspectjx'
后,它在运行时会奔溃,如果项目中有自定义的Application,那么会报找不到Application,如果项目中没有Application,那么项目中会报找不到启动类(XXXActivity),例如:
java.lang.ClassNotFoundException: Didn't find class "com.ideal.testaspectjx.MainActivity" on path: DexPathList
这里是我的配置项:
app.build.gradle
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin : 'android-aspectjx'
dependencies {
// AOP 插件库:https://mvnrepository.com/artifact/org.aspectj/aspectjrt
implementation 'org.aspectj:aspectjrt:1.9.6'
}
project.build.gradle
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionUrl=https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
我新建了一个Java空项目,没有编写aspectj语法,只是引入了依赖和插件,在只引入了apply plugin : 'android-aspectjx'插件时,它运行良好,在同时引入
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin : 'android-aspectjx'
后,它在运行时会奔溃,如果项目中有自定义的Application,那么会报找不到Application,如果项目中没有Application,那么项目中会报找不到启动类(XXXActivity),例如:
java.lang.ClassNotFoundException: Didn't find class "com.ideal.testaspectjx.MainActivity" on path: DexPathList
这里是我的配置项:
app.build.gradle
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin : 'android-aspectjx'
dependencies {
// AOP 插件库:https://mvnrepository.com/artifact/org.aspectj/aspectjrt
implementation 'org.aspectj:aspectjrt:1.9.6'
}
project.build.gradle
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionUrl=https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME