android-gradle-aspectj: java.lang.ClassNotFoundException when plugin added to a project with JavaVersion.VERSION_1_8

Hi! I encountered the following issue with projects with java 8 support. Do the following steps:

  • Start new project (File->New->New Project)
  • Add compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } to the android { } section of the app’s module
  • Run the app, check it works
  • Clean
  • Add classpath 'com.archinamon:android-gradle-aspectj:3.2.0' to the top level build.gradle and apply plugin: 'com.archinamon.aspectj' to the app level ** No aspects where added at all, nor annotated, no .aj either, just plugin
  • Run the app (you might need to run clean-build 1 or 2 times)

Result. App crashes with an exception on start:

Caused by: java.lang.ClassNotFoundException: Didn’t find class “com.demo.myapplication.MainActivity” on path: DexPathList[[zip file “/data/app/com.demo.myapplication-1/base.apk”],nativeLibraryDirectories=[/data/app/com.demo.myapplication-1/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380)

Console output: `> Task :app:transformClassesWithStackFramesFixerForDebug :app:transformClassesWithStackFramesFixerForDebug spend 741ms

Task :app:transformClassesWithDesugarForDebug :app:transformClassesWithDesugarForDebug spend 2073ms

Task :app:transformClassesWithAspectjForDebug ---------- Starting augmentation with AspectJ transformer ---------- Ajc classpath doesn’t has needed runtime environment ---------- Exit AspectJ transformer w/o processing ---------- :app:transformClassesWithAspectjForDebug spend 12ms

Task :app:transformClassesWithDexBuilderForDebug :app:transformClassesWithDexBuilderForDebug spend 107ms `

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 2
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Hi! Thanks for report! This issue occurs due to plugin incompatibility with java 8. Will be fixed soon in 3.3.0 😃

Is there any ETA on this?