Gradle sceneform 问题 - 程序类型已存在:com.google.ar.schemas.lull

Gradle issue with sceneform - Program type already present: com.google.ar.schemas.lull

我正在从事一个将在一个片段中包含 3D 模型查看器的项目。为此,我决定使用 sceneform。

我将sceneform插件下载到Adnroid studio中,从Github下载并解压sdk,我还将libsceneform_runtime_schemas库复制到我的项目中。我已经添加到我的 sceneform buil.gradle 文件行

implementation files("../libs/libsceneform_runtime_schemas.jar")

但这会导致错误:

Program type already present: com.google.ar.schemas.lull.AabbDef

值得注意的是,这是该路径下jar中的第一个文件——这可能意味着会有更多的冲突。

如果我尝试不实现此库,则会出现错误:

error: package com.google.ar.schemas.sceneform does not exist

我在 sceneform gradle 中使用 ar:core:1.17.0 和 minSdkVersion 24。 我清理并重建了项目,Invalidate Caches/Restart,并添加了 multiDexEnabled- 尽管我不确定我是否正确地完成了。 通过使用 gradlew sceneform:dependencies 我没有找到提到的文件。

我不知道我该如何前进,非常感谢任何帮助。如果我可以提供更多信息,请告诉我。

编辑 1: 我也尝试过

implementation files("../libs/libsceneform_runtime_schemas.jar"){
   exclude ...
}

但我无法让它发挥作用。我想知道这是否是我的解决方案。

此外,既然它已经存在,为什么它还要尝试实现这个 class?难道不应该对此进行某种检查吗?

我通过将我的项目从 repo 恢复到包含 sceneform 之前的最后一刻解决了我的问题,并且我再次执行了所有步骤; Gradle 依赖于 libsceneform_runtime_schemas,最小 java 8,最小 SDK 版本,再次将 scenformscr 和 sceneformux 复制到我的项目,最后 - 将所有 类 升级到 AndroidX。
两天后几乎我无法消除错误,我不知道之前出了什么问题,但这次它就像一个魅力。

TL;DR - 我从我的项目中删除了 sceneform 并再次导入它。