Ibotta / gradle-aspectj-pipeline-plugin

A Gradle plugin for Android projects which performs AspectJ weaving using Android's bytcode manipulation pipeline.
Apache License 2.0
76 stars 14 forks source link

java.lang.RuntimeException: Unable to instantiate application #17

Closed mujeebul closed 2 years ago

mujeebul commented 2 years ago

I am trying to integrate the plugin into our existing android application. The build is successful but when I launch the application I got the above error and application is closed instantly. This issue is already reported here.

What I observed in the build folder is the postWeave folder does not have any code files, only packages and sub packages are present there. The preWeave folder has all the required code.

I have tried all the available solution over internet like clean build, adding multidex-keep.txt file etc.

I tried to replicate the issue on a test application but was unable to do so.

Can you please tell me how I can get more logs around this plugin which can help fix the issue?

mujeebul commented 2 years ago

Just after raising this issue I checked the aop.log file in build folder. There was a log telling [error] classpath error: unable to find org.aspectj.lang.JoinPoint (check that aspectjrt.jar is in your classpath).

In my app the dependency implementation "org.aspectj:aspectjrt:1.9.6" was missing. After adding it the app runs successfully.

Please add this info in the Readme file.

eschlenz commented 2 years ago

@mujeebul Added to the README. Apologies for that not already being in there, but thanks for letting us know.

jdvp commented 2 years ago

@eschlenz Just saw this one and was wondering if the plugin itself should just make consumers pull in the dependency by default

i.e. in the apply function have something like

project.repositories.mavenCentral()
project.dependencies.add("implementation", "org.aspectj:aspectjrt:1.9.7")

I don't think you'd be able to use Dependencies.ASPECT_J_RUNTIME because plain gradle plugins don't seem to allow you to pass constants into the built plugin (like you can with BuildConfig in Android projects)

That way, you can ensure consumers always pull in aspectjrt. It's cool if you'd prefer the consumers do it themselves but was just wondering.