为什么Android Studio没有';你不完全认识GSON图书馆吗?
这很奇怪,因为它在实现中工作,但编辑器正在以红色突出显示导入的最后一个字(请参见附图)。并在文件下面加上“有错误”的下划线 在我的应用程序gradle上,我有:为什么Android Studio没有';你不完全认识GSON图书馆吗?,android,import,dependencies,gson,Android,Import,Dependencies,Gson,这很奇怪,因为它在实现中工作,但编辑器正在以红色突出显示导入的最后一个字(请参见附图)。并在文件下面加上“有错误”的下划线 在我的应用程序gradle上,我有: implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.google.code.gson:gson:2.8.6' 另一方面: buildscript { ext.kotlin_version = "1.5.10" r
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.code.gson:gson:2.8.6'
另一方面:
buildscript {
ext.kotlin_version = "1.5.10"
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir}
我也有错误的代码,但它正在运行。
谁能给我指出正确的方向吗?
谢谢 尝试将gson依赖项更新为2.8.7:
实现'com.google.code.gson:gson:2.8.7
'
将jcenter
添加到build.grade(项目:%name%)中的存储库中
然后同步格雷德尔。这应该行。谢谢!仅仅更新到2.8.7就成功了。我不需要添加jcenter。我也不想要它,因为它已经过时了,很快就要倒下了。@FranGaribay哦,我不知道。可能应该开始迁移到mavencentra()。谢谢你的信息!
buildscript {
repositories {
//
jcenter()
}
....
allprojects {
repositories {
//
jcenter()
}
}