当前位置:   article > 正文

Android Studio 报错:Could not get unknown property ‘kotlin_version‘ for object of type_could not get unknown property 'kotlin_version' fo

could not get unknown property 'kotlin_version' for object of type org.gradl

导入项目,sync 的时候报错:

 

  1. A problem occurred evaluating project ':app'.
  2. > Could not get unknown property 'kotlin_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

出现这个问题,我的思路一般是:新建一个空项目,然后对比两个项目的配置文件。

我的问题是原来的app下build.gradle的dependencies 格式不对,

  1. dependencies {
  2. implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  3. implementation 'androidx.core:core-ktx:1.0.1'
  4. implementation 'androidx.appcompat:appcompat:1.2.0'
  5. implementation 'com.google.android.material:material:1.0.0'
  6. implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
  7. //testImplementation 'junit:junit:4.+'
  8. //androidTestImplementation 'androidx.test.ext:junit:1.1.2'
  9. //androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
  10. }

改为如下就好了,

  1. dependencies {
  2. implementation 'androidx.core:core-ktx:1.7.0'
  3. implementation 'androidx.appcompat:appcompat:1.3.0'
  4. implementation 'com.google.android.material:material:1.4.0'
  5. implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
  6. testImplementation 'junit:junit:4.13.2'
  7. androidTestImplementation 'androidx.test.ext:junit:1.1.3'
  8. androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
  9. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/285454
推荐阅读
相关标签
  

闽ICP备14008679号