Skip to content

Commit 491bcdd

Browse files
committed
fix build and add notes to README
1 parent b39506a commit 491bcdd

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@ Each release version for this sample project will correspond to the same AGP ver
1616

1717
## Notes
1818

19+
### Important: AGP 9.0.0 and AndroidAspectExample EOL
20+
21+
It seems this project is on its last legs with the introduction of AGP 9.0.0. It shouldn't matter too
22+
much since this is just a sample project, but heads up that since AGP will be updating their DSL in 9.0.0
23+
and removing it in the near future, this project will stop working. This is because the underlying
24+
Aspect library [gradle-aspectj-pipeline-plugin] is no longer maintained since 2023 so has not updated
25+
to the new DSL.
26+
27+
For now, i.e. at least the first major release of AGP 9, this can be worked around by using the following
28+
flag in `gradle.properties`:
29+
30+
```text
31+
android.newDsl=false
32+
```
33+
34+
As mentioned below, I do not personally recommend AspectJ anymore but if you still prefer to use it,
35+
there do seem to be alternatives out there under active development, such as [AndroidAOP]. I have not
36+
personally vetted that library but it does appear to be pretty active and have a decent amount of stars.
37+
38+
This project will be updated until the `newDsl` flag is removed after which I will probably archive the project.
39+
1940
#### Plugin Change
2041

2142
As of v4.1.0, this sample project leverages the following Gradle Plugin for weaving aspects:
@@ -38,6 +59,16 @@ kotlinOptions {
3859
}
3960
```
4061

62+
If you are using a version of Kotlin/AGP where `kotlinOptions` has been deprecated or removed, you can use the following
63+
```groovy
64+
kotlin {
65+
compilerOptions {
66+
freeCompilerArgs = ["-Xsam-conversions=class"]
67+
}
68+
}
69+
```
70+
71+
4172
You can read more about the issue [here] if interested.
4273

4374
#### Using newer versions of AspectJ
@@ -90,3 +121,4 @@ and playing around with the sample project.
90121
[Why I Don't Recommend Aspect-Oriented Programming in Android in 2023]: https://jdvp.me/articles/AOP-in-Android-2023
91122
[would not be broken]: https://github.com/Ibotta/gradle-aspectj-pipeline-plugin/issues/34
92123
[desugaring]: https://android-developers.googleblog.com/2023/02/api-desugaring-supporting-android-13-and-java-nio.html
124+
[AndroidAOP]: https://github.com/FlyJingFish/AndroidAOP

app/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
apply plugin: "com.android.application"
2-
apply plugin: "kotlin-android"
32
apply plugin: "com.ibotta.gradle.aop"
43

54
java {
@@ -30,7 +29,7 @@ android {
3029
}
3130
release {
3231
minifyEnabled false
33-
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
32+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), "proguard-rules.pro"
3433
}
3534
}
3635

@@ -41,8 +40,10 @@ android {
4140
issue here:
4241
https://github.com/Ibotta/gradle-aspectj-pipeline-plugin/issues/8
4342
*/
44-
kotlinOptions {
45-
freeCompilerArgs = ["-Xsam-conversions=class"]
43+
kotlin {
44+
compilerOptions {
45+
freeCompilerArgs = ["-Xsam-conversions=class"]
46+
}
4647
}
4748

4849
testOptions {

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ org.gradle.jvmargs=-Xmx1536m
1616
# This option should only be used with decoupled projects. More details, visit
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
19+
20+
android.newDsl=false

0 commit comments

Comments
 (0)