After updating Android studio to Arctic Fox version and upgrade gradle to 7.0.0 I get gradle error

Viewed 2102

After updating Android studio to Arctic Fox version and upgrade Gradle to 7.0.0 I get Gradle error: would you help me please to solve this problem? I am using :

  • ViewModel and LiveData

  • Kotlin

  • coroutines

  • Hilt

  • Room

  • Work manager

  • Opencsv

      Exception is:
      org.gradle.api.GradleScriptException: A problem occurred evaluating project ':app'.
          at ...        Caused by: groovy.lang.MissingMethodException: No signature of method: build_81ndl2arupw8e1yms1mvvhjf2.android() is applicable for argument types: (build_81ndl2arupw8e1yms1mvvhjf2$_run_closure1) values: [build_81ndl2arupw8e1yms1mvvhjf2$_run_closure1@357f1275]
          at build_81ndl2arupw8e1yms1mvvhjf2.run(F:\Projects\InfoContest\app\build.gradle:8)
          at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)
          ... 140 more
    

android in build.gradle :

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {
    applicationId "mohalim.contest.alarm"
    minSdkVersion 21
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"
    multiDexEnabled true


    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
    dataBinding true
}


buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}
androidResources {
    noCompress 'csv'
}

}

2 Answers

I was in the same situation after upgrading to Gradle and AGP versions 7. In my case, removing the block

javaCompileOptions {
        annotationProcessorOptions {
            includeCompileClasspath false
        }
    }

from inside the android block, solved the problem.

Try to remove this block

androidResources {
    noCompress 'csv'
}

or replace it with

aaptOptions {
    noCompress 'csv'
}
Related