question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build failing with `NoSuchMethodError: ...VariantManager.getVariantScopes()Ljava/util/List` when using Android Gradle Plugin 4.1.0

See original GitHub issue

Upon applying plugin, I’m getting the following error when building:

> gradlew --stacktrace

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
   > com.android.build.gradle.internal.VariantManager.getVariantScopes()Ljava/util/List;
   > com.android.build.gradle.internal.VariantManager.getVariantScopes()Ljava/util/List;

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
        at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:75)
        at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:68)
        ...
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener.
        at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:86)
        at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:346)
        ...
Cause 1: java.lang.NoSuchMethodError: com.android.build.gradle.internal.VariantManager.getVariantScopes()Ljava/util/List;
        at com.archinamon.utils.VariantUtilsKt.getVariantScopes(VariantUtils.kt:105)
        at com.archinamon.utils.VariantUtilsKt.getVariantDataList(VariantUtils.kt:101)
        at com.archinamon.plugin.PluginSetupKt.prepareVariant(PluginSetup.kt:53)
        at com.archinamon.plugin.PluginSetupKt.access$prepareVariant(PluginSetup.kt:1)
        ...
Cause 2: java.lang.NoSuchMethodError: com.android.build.gradle.internal.VariantManager.getVariantScopes()Ljava/util/List;
        at com.archinamon.utils.VariantUtilsKt.getVariantScopes(VariantUtils.kt:105)
        at com.archinamon.utils.VariantUtilsKt.getVariantDataList(VariantUtils.kt:101)
        at com.archinamon.api.transform.AspectJTransform$prepareProject$1.execute(AspectJTransform.kt:37)
        at com.archinamon.api.transform.AspectJTransform$prepareProject$1.execute(AspectJTransform.kt:23)
        ...

Windows 10; Gradle 6.3…6.7; Android Gradle Plugin 4.1.0. AGP 4.0.+ works.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:10

github_iconTop GitHub Comments

7reactions
jiechiccommented, Nov 6, 2020

@Archinamon when will publish Android-Gradle-Aspectj:4.3.0 for fix AGP 4.1.0 bug?you merge PR #128 but isn’t published

1reaction
oakkittencommented, Mar 5, 2021

in case someone needs this, here’s a manual way of weaving aspectj on android. you will have to tweak the Transform a bit to suite your needs but it’s gradle kotlin dsl, only depends on aspectjtools & aspectjrt, and even deals with some nasty windows issue of gradle not releasing some file locks

https://stackoverflow.com/a/64673644/1449683

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ask Question - Stack Overflow
Error:Unable to find method 'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;'. Possible causes for this ...
Read more >
Known issues with Android Studio and Android Gradle Plugin
This update causes an underlying behavior change related to signing keys. When you navigate to Build > Generate Signed Bundle / APK and...
Read more >
NoSuchMethodError in KotlinAndroidPlugin : KT-17642
I am using kotlin 1.1.2 in Android Studio 2.4 Preview 6. I am using com.android.tools.build:gradle:2.5.0-alpha-preview-02 for my gradle plugin.
Read more >
Upgrading your build from Gradle 4.x to 5.0
If you are using Gradle for Android, you need to move to version 3.3 or higher of both the Android Gradle Plugin and...
Read more >
Bugsnag docs › Build & deploy integrations › Gradle (Android)
Upload ProGuard, DexGuard, and R8 mappings, NDK symbol files, React Native source maps, and report builds to Bugsnag using our Gradle plugin for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found