LibGDX:如何将Google移动视觉API添加到LibGDX项目中?

LibGDX: How to add Google Mobile Vision API to a LibGDX project?

也许答案很简单,但是我还找不到任何可以帮助我的东西。 基本上,我想将 Google 愿景 API 添加到我的项目中。我试过把

compile 'com.google.android.gms:play-services-vision:9.0.0+'

in build.gradle dependencies 在 Android 模块中,就像在这个 tutorial 中一样。这没有用(也许我应该把它写在别的地方?我想不通)。现在在这个build.gradle中显示了很多检查。据说有组件不能应用到groovy.lang.Closure.

我已经安装了 Google 存储库。我已经完成了那个不是 LibGDX 的教程,并且在那里一切正常。

那么如何让它与 LibGDX 一起工作?

解决方法是添加:

compile 'com.google.apis:google-api-services-vision:v1-rev20-1.22.0'

进入 build.gradle 根目录 build.gradle (位于项目的根目录中)在 android 依赖项下,而不是特定于模块的依赖项。

project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        compile project(":core")
        ........
        compile 'com.google.apis:google-api-services-vision:v1-rev20-1.22.0'
    }
}