diff --git a/aspectj-plugin/src/main/java/io/freefair/gradle/plugins/aspectj/AspectJPlugin.java b/aspectj-plugin/src/main/java/io/freefair/gradle/plugins/aspectj/AspectJPlugin.java index f5fd7971..ae1063c8 100644 --- a/aspectj-plugin/src/main/java/io/freefair/gradle/plugins/aspectj/AspectJPlugin.java +++ b/aspectj-plugin/src/main/java/io/freefair/gradle/plugins/aspectj/AspectJPlugin.java @@ -33,6 +33,13 @@ public void apply(Project project) { throw new IllegalStateException("Another aspectj plugin (which is excludes this one) has already been applied to the project."); } + project.getPlugins().withId("com.android.application", ignored -> { + throw new IllegalStateException("The 'io.freefair.aspectj' plugin is not compatible with android projects"); + }); + project.getPlugins().withId("com.android.library", ignored -> { + throw new IllegalStateException("The 'io.freefair.aspectj' plugin is not compatible with android projects"); + }); + this.project = project; project.getPlugins().apply(AspectJBasePlugin.class); project.getPlugins().apply(JavaBasePlugin.class); diff --git a/aspectj-plugin/src/main/java/io/freefair/gradle/plugins/aspectj/AspectJPostCompileWeavingPlugin.java b/aspectj-plugin/src/main/java/io/freefair/gradle/plugins/aspectj/AspectJPostCompileWeavingPlugin.java index 9eea097c..e7bef837 100644 --- a/aspectj-plugin/src/main/java/io/freefair/gradle/plugins/aspectj/AspectJPostCompileWeavingPlugin.java +++ b/aspectj-plugin/src/main/java/io/freefair/gradle/plugins/aspectj/AspectJPostCompileWeavingPlugin.java @@ -36,6 +36,13 @@ public void apply(Project project) { throw new IllegalStateException("Another aspectj plugin (which is excludes this one) has already been applied to the project."); } + project.getPlugins().withId("com.android.application", ignored -> { + throw new IllegalStateException("The 'io.freefair.aspectj.post-compile-weaving' plugin is not compatible with android projects"); + }); + project.getPlugins().withId("com.android.library", ignored -> { + throw new IllegalStateException("The 'io.freefair.aspectj.post-compile-weaving' plugin is not compatible with android projects"); + }); + this.project = project; aspectjBasePlugin = project.getPlugins().apply(AspectJBasePlugin.class);