无法编译 ThreeTenABP

Unable to compile ThreeTenABP

我正在尝试使用 Jake Wharton 的 ThreeTenABP 库 - https://github.com/JakeWharton/ThreeTenABP - for JSR310 date/time features in my Android project. This library's main advantage is that it has less compile overhead than Jodatime (http://www.joda.org/joda-time/) and threetenbp (https://github.com/ThreeTen/threetenbp)。但是,ThreeTenABP 库没有在我的项目中编译。我将以下内容放入 build.gradle:

compile 'org.threeten:threetenbp:1.3-SNAPSHOT'
compile 'com.jakewharton.threetenabp:threetenabp:1.0.0-SNAPSHOT'

然后出现编译错误:

Error:Could not find org.threeten:threetenbp:1.3-SNAPSHOT. Required by: MyApp:app:unspecified MyApp:app:unspecified > com.jakewharton.threetenabp:threetenabp:1.0.0-SNAPSHOT Search in build.gradle files

有人在 Android 之前成功使用过这个库吗?

这是构建过程的问题,无法下载依赖项。

这很可能是因为您没有将快照存储库作为 Readme file in the repository says 添加到项目中。

您应该可以通过将以下内容添加到顶级 build.gradle 文件来解决此问题

buildscript {
  repositories {
    mavenCentral()
    maven {
      url "https://oss.sonatype.org/content/repositories/snapshots"
    }
  }
  dependencies {
  }
}

编辑:

评论是对的,不是版本库本身的问题。 问题是 org.threeten:threetenbp:1.3-SNAPSHOT 在两个存储库中都不存在。 ( bintray or snapshots )

编辑#2:

请在项目

上查看this issue

JakeWharton commented 11 hours ago You need the 1.3-SNAPSHOT of the notzdb branch of the ThreeTenBP project.

编辑#3:

事实上,我刚刚看到你是制造问题的人:) 您需要自己构建它,因为它没有托管在任何存储库中:

$ git clone https://github.com/ThreeTen/threetenbp
$ cd ThreeTen/
$ git checkout no-tzdb
$ mvn clean install

此外,值得一提的是,ThreeTen 有两个独立的项目,是分支所在的最后一个活跃项目

https://github.com/ThreeTen/threeten

https://github.com/ThreeTen/threetenbp