我在运行 gradle build 时收到此错误:指定为非空的参数为空

问题描述

当项目正在同步时,我在第 18 行 resVlaue("") 收到以下错误: 评估项目“:app”时出现问题。

参数指定为非空为空:方法com.android.build.gradle.internal.dsl.BaseFlavor.resValue,参数值 应用插件:'com.android.application' 应用插件:'kotlin-android' 应用插件:'kotlin-android-extensions' 应用插件:'kotlin-kapt' 应用插件:“androidx.navigation.safeargs”

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def fbApiScheme = properties.getProperty('fbApiScheme')
def fbApiKey = properties.getProperty('fbApiKey')

android {
  lintOptions {
    baseline file("lint-baseline.xml")
  }
  compileSdkVersion  rootProject.ext.compileSdk
  defaultConfig {
    resValue("string","fbApiKey",fbApiKey)
    resValue("string","fbApiScheme",fbApiScheme)
    vectorDrawables.useSupportLibrary = true
    applicationId "org.aossie.agoraandroid"
    minSdkVersion rootProject.ext.minSdk
    targetSdkVersion targetSdk
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  }
  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
    }
    debug {
      debuggable true
    }
  }
  buildFeatures {
    dataBinding = true
  }
  kotlinOptions {
    jvmTarget = JavaVersion.VERSION_1_8.toString()
  }
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
}

dependencies {
  implementation fileTree(dir: 'libs',include: ['*.jar'])
  implementation "androidx.appcompat:appcompat:$appCompatVersion"
  implementation "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion"
  implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
  testImplementation "junit:junit:$junitVersion"
  androidTestImplementation "androidx.test:runner:$testRunnerVersion"
  androidTestImplementation "androidx.test.espresso:espresso-core:$espressoCoreVersion"
  // Lifecycle components
  implementation "androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion"
  kapt "androidx.lifecycle:lifecycle-compiler:2.3.1"
  //Design Support Library
  implementation "com.google.android.material:material:$materialDesignVersion"
  //Library for CardView
  implementation "androidx.cardview:cardview:$cardViewVersion"
  //Retrofit
  implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
  implementation "com.squareup.retrofit2:converter-scalars:$retrofitConverterScalarsVersion"
  //GSON and GSON converter
  implementation "com.squareup.retrofit2:converter-gson:$retrofitConverterGsonVersion"
  implementation "com.google.code.gson:gson:$gsonVersion"
  //Navigation Architecture Dependencies
  implementation "androidx.navigation:navigation-fragment-ktx:$navFragmentVersion"
  implementation "androidx.navigation:navigation-ui-ktx:$navUiVersion"
  //Shimmer
  implementation "com.facebook.shimmer:shimmer:$facebookShimmerVersion"
  //Facebook Login
  implementation "com.facebook.android:facebook-login:$facebookLoginVersion"
  implementation 'com.facebook.android:facebook-android-sdk:9.1.0'
  //Pie Chart
  implementation "com.github.PhilJay:MPAndroidChart:v3.1.0"
  //MockWebServer and Roboelectric
  testImplementation "org.robolectric:robolectric:$robolectricVersion"
  testImplementation "com.squareup.okhttp3:mockwebserver:$mockWebServerVersion"
  // Mockito
  testImplementation "org.mockito:mockito-core:$mockitoCoreVersion"
  testImplementation 'org.json:json:20210307'
  //kotlin deps
  implementation "androidx.core:core-ktx:1.3.2"
  implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1' //TODO
  implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4.31'
  //dagger
  implementation "com.google.dagger:dagger:$daggerVersion"
  kapt "com.google.dagger:dagger-compiler:$daggerVersion"
  //Shared Prefs
  implementation "androidx.preference:preference-ktx:$prefsVersion"
  // room
  implementation "androidx.room:room-runtime:$roomVersion"
  kapt "androidx.room:room-compiler:$roomVersion"
  implementation "androidx.room:room-ktx:$roomVersion"
  // coroutine
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion"
  implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3-native-mt'
  //horizontal calendar
  implementation "devs.mulham.horizontalcalendar:horizontalcalendar:$calendarVersion"
  //day view lib
  implementation "com.linkedin.android.tachyon:tachyon:$tachyonVersion"
  //picasso
  implementation "com.squareup.picasso:picasso:$picassoVersion"
  //timber
  implementation "com.jakewharton.timber:timber:$timberVersion"
  //httpLoggingInterceptor
  implementation "com.squareup.okhttp3:logging-interceptor:$httpLoggingInterceptor"
  //chucker
  debugImplementation "com.github.chuckerteam.chucker:library:$chuckerVersion"
  releaseImplementation "com.github.chuckerteam.chucker:library-no-op:$chuckerVersion"

  //leakcanary
  debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanaryVersion"
}
repositories {
  mavenCentral()
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...