Archinamon / android-gradle-aspectj

gradle plug-in adding supports of AspectJ into Android project
Apache License 2.0
363 stars 58 forks source link

Java 8 support? #68

Closed davidwong closed 6 years ago

davidwong commented 6 years ago

I have got version 3.2.0 of the plugin to work with Android Studio / Android gradle plugin 3.0 (thank you very much for that!). There was a build problem with one project that had some Java 8 code in it.

Just wanted to ask if your plugin is supposed to support Java 8 or not. If so I can upload some error logs. Some further info about the problem:

Archinamon commented 6 years ago

Hi!

Plugin doesn't support java 8 usage within .aj files, but should support it for java-annotation style. This works 'cause .class inputs on transform stage should not be with 52 bytecode version (java8 signature). It would great to provide crash logs and gradle configs to allow me to reproduce this behavior :)

davidwong commented 6 years ago

Hi, I didn't have java 8 code in the aspects, just in app code. But I think the issue may have been with Gradle (maybe caching?) or how the build process interacts with your plugin.

I was preparing a sample app for you to look that was reproducing the problem. I took out all the aspectj stuff and gradually added it back in, and it started working, with the same code as before.

I'm still having problems getting the plugin to work with a complex app, but I don't think it is related to java 8, so I'll close this issue for now. I'll let you know what I find.

Anyway for future reference here were the errors I was getting. It was the app:transformClassesWithDexBuilderForLiteDebug build stage that was causing the problem, running straight after app:transformClassesWithAspectjForLiteDebug. It almost looked like the dex was trying to run on classes that had bypassed the desugar stage.

build.gradle.txt

ajc-compile.log error.txt

Archinamon commented 6 years ago

Looks veeery interesting. And strange. Aj transformer didn't proceed the code just like if you describe aspectj-provides plugin instead of aspectj-ext. And then fails like your app doesn't support java8 but compiled into 52 bytecode. Waaat :)

Please, let me know if such behavior will reproduce again. It would to be a very mystery bug.