4

I am use aspect, the problem is come out when upgrade gradle from 2.2.3 to 2.3.0 in this line :

"-bootclasspath", plugin.project.android.bootClasspath.join(
            File.pathSeparator)]

here is the full build.gradle

android.libraryVariants.all { variant ->
LibraryPlugin plugin = project.plugins.getPlugin(LibraryPlugin)
JavaCompile javaCompile = variant.javaCompile
javaCompile.doLast {
    String[] args = ["-showWeaveInfo",
                     "-1.5",
                     "-inpath", javaCompile.destinationDir.toString(),
                     "-aspectpath", javaCompile.classpath.asPath,
                     "-d", javaCompile.destinationDir.toString(),
                     "-classpath", javaCompile.classpath.asPath,
                     "-bootclasspath", plugin.project.android.bootClasspath.join(
            File.pathSeparator)]

    MessageHandler handler = new MessageHandler(true);
    new Main().run(args, handler)

    def log = project.logger
    for (IMessage message : handler.getMessages(null, true)) {
        switch (message.getKind()) {
            case IMessage.ABORT:
            case IMessage.ERROR:
            case IMessage.FAIL:
                log.error message.message, message.thrown
                break;
            case IMessage.WARNING:
            case IMessage.INFO:
                log.info message.message, message.thrown
                break;
            case IMessage.DEBUG:
                log.debug message.message, message.thrown
                break;
        }
    }
}

}

here is the error

11:14:38.176 [ERROR] 
[org.gradle.internal.buildevents.BuildExceptionReporter] Build file '************/build.gradle' line: 42
11:14:38.176 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
11:14:38.176 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
11:14:38.176 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':yfdaq:compileReleaseJavaWithJavac'.
11:14:38.176 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > No such property: project for class: com.android.build.gradle.LibraryPlugin
11:14:38.176 [ERROR] 
yefeng
  • 111
  • 1
  • 14
  • I am having same error, any one can help? this is the reference link https://fernandocejas.com/2014/08/03/aspect-oriented-programming-in-android/ and referring this github repository https://github.com/android10/Android-AOPExample When i try to merge gintonic library module in my project this is giving me same error – Pratibha sarve May 03 '17 at 07:25

2 Answers2

3

@yefeng for now to run your application you can remove below line of codes from library level build.gradle

LibraryPlugin plugin = project.plugins.getPlugin(LibraryPlugin)

and

, "-bootclasspath", plugin.project.android.bootClasspath.join(
                File.pathSeparator)

and sync gradle, work for me, at least i can log message now.

Pratibha sarve
  • 369
  • 2
  • 11
1

I've fixe the problem by changing plugin.project.android.bootClasspath to android.bootClasspath

Szymon Stepniak
  • 40,216
  • 10
  • 104
  • 131
strayuncle
  • 21
  • 1