Java 模块没有`api`,必须使用`compile`?

Java Module doesn't have `api`, and have to use `compile`?

https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#new_configurations 所述,我们现在有 apiimplementation

在 Android 模块中,即 apply plugin: 'com.android.application',我们两者都有。

然而,在普通的 Java 模块中,即 apply plugin: 'java'(由我的 Android 应用程序模块使用),我只能找到 implementation,但找不到 api.

因此在其中一个依赖中,我需要使用compile,而不能使用api
在 Java 模块无法访问 api 吗?

你必须使用:

apply plugin: 'java-library'

The key difference between the standard Java plugin and the Java Library plugin is that the latter introduces the concept of an API exposed to consumers.

The plugin exposes two configurations that can be used to declare dependencies: api and implementation.

更多info here.