Archinamon / android-gradle-aspectj

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

Gradle sync error (NoSuchField) with Android Gradle 3.2.0-beta01+ #80

Closed sjcqs closed 5 years ago

sjcqs commented 6 years ago

Version: 3.2.0

With the lastest versions of android-gradle (starting version 3.2.0 beta 1), this plugins causes gradle sync to fail due to

java.lang.NoSuchFieldError: javacTask
at com.archinamon.utils.VariantUtilsKt.getJavaTask(VariantUtils.kt:13)

In latest android-gradle versions, javacTask's name has changed.

kashishm27 commented 5 years ago

Any updates? Or did you use anything else?

AhmedVargos commented 5 years ago

I have the same problem with android studio Version: 3.2.0

any updates?

jdappel commented 5 years ago

I have published a fix for this issue if anyone has an urgent need to mitigate this issue: https://bintray.com/jdappel/maven/android-gradle-aspectj.

sheelaknaik commented 5 years ago

Hello, please let me know by when do we get an updated build. This is blocking my development.

sheelaknaik commented 5 years ago

I have published a fix for this issue if anyone has an urgent need to mitigate this issue: https://bintray.com/jdappel/maven/android-gradle-aspectj.

Hi @jdappel , I get following exception on compiling the project. Attaching sample app for reference.

Unable to find method 'org.gradle.api.file.ProjectLayout.files([Ljava/lang/Object;)Lorg/gradle/api/file/FileCollection;'. Possible causes for this unexpected error include:

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes. TestApplication.zip

neyguvj commented 5 years ago

We recently updated AGP to 3.2.1 (gradle 4.6) and have the same problem.

jdappel commented 5 years ago

I have published a fix for this issue if anyone has an urgent need to mitigate this issue: https://bintray.com/jdappel/maven/android-gradle-aspectj.

Hi @jdappel , I get following exception on compiling the project. Attaching sample app for reference.

Unable to find method 'org.gradle.api.file.ProjectLayout.files([Ljava/lang/Object;)Lorg/gradle/api/file/FileCollection;'. Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes. TestApplication.zip

Which version of Gradle are you using? AGP 3.2.+ requires Gradle 4.6+

sheelaknaik commented 5 years ago

I have published a fix for this issue if anyone has an urgent need to mitigate this issue: https://bintray.com/jdappel/maven/android-gradle-aspectj.

Hi @jdappel , I get following exception on compiling the project. Attaching sample app for reference. Unable to find method 'org.gradle.api.file.ProjectLayout.files([Ljava/lang/Object;)Lorg/gradle/api/file/FileCollection;'. Possible causes for this unexpected error include:

  • Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network)
  • The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart)
  • Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.

In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes. TestApplication.zip

Which version of Gradle are you using? AGP 3.2.+ requires Gradle 4.6+

@jdappel , yes AGP 3.2 with Gradle 4.6. Please refer the attached reference app if I'm missing anything..Thank you so much

jdappel commented 5 years ago

@sheelaknaik Please use Gradle 4.8+. I removed a few deprecated warnings with new methods that were added in Gradle 4.8

sheelaknaik commented 5 years ago

@jdappel, thank you. This works. However, I'm concerned if we can support Gradle 4.6 as well due to project dependency.

Archinamon commented 5 years ago

Hello everybody! Sorry for my absence, RL completely ate me for some time. I've published 3.3.0 update with pull/81 and some my own stuff. Please, check it out.

sheelaknaik commented 5 years ago

Hi Archinamon, thanks for the upgrade. However, this version fails with Gradle 4.8, Gradle plugin version 3.2 with below error. This is when trying to build aspect library using "apply plugin: 'com.archinamon.aspectj-ext'

divankov commented 5 years ago

3.3.0 doesn't work with AGP 3.2.0 + gradle 4.6 Caused by: java.lang.NoSuchMethodError: org.gradle.api.file.ProjectLayout.files([Ljava/lang/Object;)Lorg/gradle/api/file/FileCollection; at com.archinamon.utils.VariantUtilsKt.getAjSourceAndExcludeFromJavac(VariantUtils.kt:27) at com.archinamon.api.transform.AspectJTransform.setupVariant(AspectJTransform.kt:62) at com.archinamon.api.transform.AspectJTransform.access$setupVariant(AspectJTransform.kt:22) at com.archinamon.api.transform.AspectJTransform$prepareProject$1.execute(AspectJTransform.kt:36) at com.archinamon.api.transform.AspectJTransform$prepareProject$1.execute(AspectJTransform.kt:22)

also doesn't work with AGP 3.1.0 + gradle 4.5 Caused by: java.lang.NoSuchMethodError: com.android.build.gradle.internal.variant.BaseVariantData.getTaskContainer()Lcom/android/build/gradle/internal/scope/TaskContainer; at com.archinamon.utils.VariantUtilsKt.getJavaTask(VariantUtils.kt:16) at com.archinamon.plugin.PluginSetupKt.configureCompiler(PluginSetup.kt:67) at com.archinamon.plugin.PluginSetupKt.access$configureCompiler(PluginSetup.kt:1) at com.archinamon.plugin.PluginSetupKt$configProject$1.execute(PluginSetup.kt:28) at com.archinamon.plugin.PluginSetupKt$configProject$1.execute(PluginSetup.kt)

Archinamon commented 5 years ago

Version 3.3.0 still works with AGP 3.0.1 AGP 3.2.1 version supporting with 3.3.1 I've been published. Try it, please. 3.1.0-3.2.0 maybe won't work properly due to migration agp to kotlin.

pavelaizen commented 4 years ago

Gradle sync failed: Cause: javacTask

Same issue with: classpath 'com.android.tools.build:gradle:3.5.2' classpath "com.archinamon:android-gradle-aspectj:3.2.0"

Any fixes?