How do I fix "Unable to find method" error?

Viewed 140

Full error:

Unable to find method 'org.gradle.api.artifacts.result.ComponentSelectionReason.getDescription()Ljava/lang/String;'.
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.

All other methods suggest downgrading gradle, but downgrading gradle only gives another error that says "minimum supported gradle version is 7.0.2"

This is the gradle-wrapper.properties file

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip

This is the top level build.gradle file

buildscript {
    ext.kotlin_version = '1.3.50'

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.1'
        // classpath 'com.android.tools.build:gradle:6.8.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

Project level build.gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29

    signingConfigs {
        release {
            storeFile file('--redacted--')
            storePassword '--redacted--'
            keyAlias '--redacted--'
            keyPassword '--redacted--'
        }
    }

    defaultConfig {
        applicationId '--redacted--'
        minSdkVersion 24
        targetSdkVersion 29
        versionCode 123
        versionName '1.2.3'
        signingConfig signingConfigs.release
        project.ext.set("archivesBaseName", "--redacted--" + versionName + "(" + Integer.toString(versionCode) + ")")
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
        }
        externalNativeBuild {
            cmake {
                arguments '-DANDROID_TOOLCHAIN=clang'
                abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
            }
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
        }
    }
    externalNativeBuild {
        cmake {
            path 'src/main/cpp/CMakeLists.txt'
        }
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
    implementation project(':audio-device')
    implementation 'com.anjlab.android.iab.v3:library:1.0.44'
    implementation 'com.android.billingclient:billing:3.0.0'
}

Android studio version:

Android Studio 4.0
Build #AI-193.6911.18.40.6514223, built on May 21, 2020
Runtime version: 1.8.0_242-release-1644-b01 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1246M
Cores: 4
Registry: editor.skip.copy.and.cut.for.empty.selection=true, ide.new.welcome.screen.force=true, debugger.watches.in.variables=false
Non-Bundled Plugins: 

This project was copied over from a different computer which probably uses a different version of Android Studio. Other older projects created on my computer using my current version of Android Studio open as expected. I don't even need to be able to compile this project, just use editing features (such as ctrl+click to go to variable declaration location, view rendered version of xml layout files) which are not working because gradle is not syncing. How do I fix this problem?

0 Answers
Related