【发布时间】:2015-06-15 11:07:35
【问题描述】:
如何使用 gradle 将 gson 添加到我的项目中?我只看到人们将文件添加到他们的项目中。我不想下载项目并把它放在我的。
【问题讨论】:
-
一般来说,我们鼓励张贴者展示他们尝试过的东西,或者他们所做的研究。但是,我在这个问题上注意到这一点为时已晚 - 您似乎已经有了一个快速的答案!
标签: android
如何使用 gradle 将 gson 添加到我的项目中?我只看到人们将文件添加到他们的项目中。我不想下载项目并把它放在我的。
【问题讨论】:
标签: android
compile 已过时,改用implementation
dependencies {
implementation 'com.google.code.gson:gson:2.8.5'
}
附: 2019 年 8 月 7 日的版本
【讨论】:
在 app/build.gradle 中:
dependencies {
compile 'com.google.code.gson:gson:2.8.2'
}
【讨论】:
implementation 'com.google.code.gson:gson:2.8.6' 因为 compile 已被弃用
将关注添加到项目的build.gradle
repositories {
mavenCentral()
}
dependencies {
compile 'com.google.code.gson:gson:2.8.0'
}
Here 是更多信息的链接。
【讨论】: