提问人:Usama Mansoor 提问时间:6/2/2023 更新时间:6/2/2023 访问量:261
安装新 Windows 和 Android Studio 后 Gradle 同步失败(无法转换字符串值“UNIFIED_TEST_PLATFORM”)
Gradle sync failed after installing new windows and android studio (Cannot convert string value 'UNIFIED_TEST_PLATFORM')
问:
我安装了 Windows 11 和 android studio arctic fox 2020.3.1 补丁 4。但是在添加我以前的项目后,我在 gradle 同步时出现错误
“无法将字符串值'UNIFIED_TEST_PLATFORM'转换为类型为'com.android.builder.model.AndroidGradlePluginProjectFlags$BooleanFlag'的枚举值(有效值不区分大小写:APPLICATION_R_CLASS_CONSTANT_IDS、TEST_R_CLASS_CONSTANT_IDS、TRANSITIVE_R_CLASS、JETPACK_COMPOSE、ML_MODEL_BINDING) "
这是我的build.gradle(项目)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven { url 'https://www.jitpack.io' }
maven { url = uri("https://plugins.gradle.org/m2/") }
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:perf-plugin:1.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:deprecation"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
)
这是我的build.gradle(应用程序)
plugins {
id 'com.android.application'
id("org.jetbrains.kotlin.android")
id 'kotlin-android'
id 'kotlin-kapt'
id 'com.google.gms.google-services'
id 'com.google.firebase.firebase-perf'
}
android {
compileSdk 33
lint {
baseline = file("lint-baseline.xml")
}
signingConfigs {
release {
storeFile file('C:\\Users\\admin\\.android\\release.keystore')
storePassword ''
keyAlias ''
keyPassword ''
}
}
buildFeatures {
viewBinding true
}
defaultConfig {
multiDexEnabled true
applicationId "com.nexuscorppg.getquiz"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0.1"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
namespace 'com.nexuscorppg.getquiz'
}
dependencies {
implementation 'com.unity3d.ads:unity-ads:4.7.0'
implementation 'com.hbb20:ccp:2.7.2'
implementation 'com.github.bumptech.glide:glide:4.15.1'
kapt 'com.github.bumptech.glide:compiler:4.15.1'
implementation 'com.github.iwgang:countdownview:2.1.6'
implementation 'com.google.android.play:core:1.10.3'
implementation "androidx.core:core-ktx:1.10.1"
implementation("androidx.fragment:fragment-ktx:1.5.7")
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'io.github.pilgr:paperdb:2.7.2'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation platform('com.google.firebase:firebase-bom:32.0.0')
implementation 'com.google.firebase:firebase-auth:22.0.0'
implementation 'com.google.android.gms:play-services-safetynet:18.0.1'
implementation 'com.google.firebase:firebase-firestore:24.6.1'
implementation 'com.google.firebase:firebase-analytics:21.3.0'
implementation 'com.google.firebase:firebase-storage:20.2.0'
implementation 'com.google.firebase:firebase-perf:20.3.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
我已经将我的 gradle 更新到最新的稳定版,并更新了所有插件,但仍然收到此错误
答: 暂无答案
评论