'android.enableUnitTestBinaryResources' is deprecated

11,053

I figured out what the problem is. From Android studio 3.3+ there is no need to add the code below to "gradle.properties" file.

android.enableUnitTestBinaryResources=true

So it must be removed.

Share:
11,053
Ehsan Nokandi
Author by

Ehsan Nokandi

Updated on June 03, 2022

Comments

  • Ehsan Nokandi
    Ehsan Nokandi almost 2 years

    I just updated my Android Studio and now when I build my project I get this error:

    The option 'android.enableUnitTestBinaryResources' is deprecated. The current default is 'false'. It has been removed from the current version of the Android Gradle plugin. The raw resource for unit test functionality is removed. Affected Modules: app

    Here is my build.gradle(:app)

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-kapt'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'androidx.navigation.safeargs.kotlin'
    
    
    android {
        compileSdkVersion 28
        defaultConfig {
            applicationId "com.oniktech.newmixnote"
            minSdkVersion 21
            targetSdkVersion 28
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
    
        compileOptions {
            sourceCompatibility rootProject.ext.java_version
            targetCompatibility rootProject.ext.java_version
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    
        sourceSets {
            String sharedTestDir = 'src/test/java'
            test {
                java.srcDir sharedTestDir
            }
            androidTest {
                java.srcDir sharedTestDir
            }
        }
    
        testOptions {
            unitTests {
                includeAndroidResources = true
            }
        }
    
    
        externalNativeBuild {
            ndkBuild {
                path '/src/main/jni/Android.mk'
            }
        }
    
    }
    
    
    dependencies {
    
    
        def camerax_version = "1.0.0-alpha02"
        implementation "androidx.camera:camera-core:${camerax_version}"
        implementation "androidx.camera:camera-camera2:${camerax_version}"
    
    
        implementation 'androidx.fragment:fragment:1.1.0-rc02'
        implementation 'androidx.core:core-ktx:1.0.2'
        implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
    
    
        implementation 'androidx.appcompat:appcompat:1.0.2'
        implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0-alpha01'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    
    
        implementation 'com.github.bumptech.glide:glide:4.9.0'
        implementation 'androidx.legacy:legacy-support-v4:1.0.0'
        kapt 'com.github.bumptech.glide:compiler:4.9.0'
    
    
        androidTestImplementation 'androidx.test.ext:junit:1.1.1'
        androidTestImplementation 'androidx.test:rules:1.2.0'
        androidTestImplementation 'androidx.test:runner:1.2.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        testImplementation 'junit:junit:4.12'
    
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation 'com.android.support:appcompat-v7:28.0.0'
        implementation 'com.android.support.constraint:constraint-layout:1.1.3'
        implementation 'com.android.support:support-v4:28.0.0'
        implementation 'androidx.recyclerview:recyclerview:1.0.0'
        implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0'
        implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0'
        implementation 'com.squareup.picasso:picasso:2.71828'
    
    
        implementation 'com.github.chrisbanes:PhotoView:2.3.0'
        implementation 'com.android.support:support-media-compat:28.0.0'
        implementation 'com.patrickpissurno:ripple-effect:1.3.1'
    }
    

    I removed the below line but it didn't fix the problem:

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    And here is my gradle.build(:project):

    buildscript {
        ext.kotlin_version = '1.3.50'
        ext.java_version = JavaVersion.VERSION_1_8
    
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:4.0.0'
            classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha09"
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
            classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha11"
        }
    }
    
    allprojects {
        repositories {
            google()
            jcenter()
            mavenLocal()
            maven { url "https://jitpack.io" }
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    I would be appreciated if you could help me with this.