'android.enableUnitTestBinaryResources' 已被弃用
2022-09-01 06:19:59
我刚刚更新了我的Android Studio,现在当我构建我的项目时,我得到这个错误:
选项'android.enableUnitTestBinaryResources'已被弃用。当前默认值为“false”。它已从当前版本的Android Gradle插件中删除。将删除单元测试功能的原始资源。受影响的模块:应用程序
这是我的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'
}
我删除了下面的行,但它没有解决问题:
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
这是我的 gradle.build(:p roject):
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
}
如果您能帮助我,我将不胜感激。