Open Adm123Git opened 4 years ago
My setup is probably not the proper way, I have not really messed around with it yet since it currently "works" for what I am doing. I designed it based off of another post discussing issue with newer versions of this plugin which is why I am using 3.4.0. One major problem I always run into is after 5 or so builds/rebuilds, I need to invalidate caches and restart IntelliJ due to Archinamon files still being used. Probably due to my build.gradle setup.
My app build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.archinamon.aspectj'
buildscript {
repositories {
google()
maven { url "https://jitpack.io" }
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "com.archinamon:android-gradle-aspectj:3.4.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.aspectideaone"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation project(':coupleaspects') //android library with my aspects
implementation 'com.google.android.material:material:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
aspectj {
includeAspectsFromJar 'coupleaspects'
debugInfo true
ajcArgs << '-referenceInfo' << '-warn:deprecation' << '-verbose'
}
My android library build.gradle
apply plugin: 'com.android.library'
apply plugin: 'com.archinamon.aspectj-provides'
buildscript {
repositories {
google()
maven {url "https://jitpack.io" }
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "com.archinamon:android-gradle-aspectj:3.4.0"
}
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
aspectj {
debugInfo true
ajcArgs << '-referenceInfo' << '-warn:deprecation' << '-verbose'
}
Didn't put anything in project build.gradle file.
Hope this helps.
MatthewBerk, tnhank you! I'll try it soon
Update your gradle-wrapper.properties file with below version.
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
Setting Gradle to 6.3 and min SDK to 24 solves this error.
@Adm123Git did any of the above suggestions work for you? if so, please mark this issue as resolved
Hi, My project requires minSDK = 16, which version of the plugin should you use?
Thanks!
Hi, My project requires minSDK = 16, which version of the plugin should you use?
Thanks!
Hi! At least you have to use corresponding version of gradle and aspectj plugins. You may use aspectj 4.1.0 with Gradle 6.3+ and AndroidGradlePlugin 3.6.+ Or, aspectj 4.2.0 with Gradle 6.3+ and AndroidGradlePlugin 4.0.+
No other requirement on minSdk should not affect your build.
Please, help me..! I'm newbie in android...
My project gradle.build:
My app gradle.build:
Pjoject compiling normal. Try start on device and... Method
com/archinamon/api/ClasspathFileCollection.getBuildDependencies()Lorg/gradle/api/tasks/TaskDependency; is abstract
What can I do?