无法导入 Cardboard SDK

Can't import Cardboard SDK

将 Cardboard SDK 导入我的项目时出现问题。

我下载了cardboard-java Github repository 然后将文件从它的库复制到我项目的库文件夹并添加以下依赖项:

 compile project(':libraries-common')

 compile project(':libraries-commonwidget')

 compile project(':libraries-videowidget')

但它给出错误提示:

Project with path ':libraries-common' could not be found in project ':app'.

请帮助我理解我做错了什么,并告诉我是否有其他导入SDK的方法。

谢谢

project 语法用于描述对单独 subproject of your root Gradle project. Note that the example repository is aware of all the library subprojects 的依赖。您可能需要更新自己的 settings.gradle 以同样了解您已复制到 Android Studio 项目中的库子项目。

或者,重新开始并确保您遵循本 Getting Started 指南中的每一步。特别是,使用 New module 导入方法应该会自动更新您的 settings.gradle 文件:

First, grab all the required .AAR files from the libraries folder of the sdk. To determine which .AARs you need to depend on, you can examine the build.gradle files of the various sample apps. For example, samples/treasurehunt/build.gradle's dependency section has the following entries:

dependencies {
  compile project(':libraries-audio')
  compile project(':libraries-common')
  compile project(':libraries-core')
}

This indicates that an application similar to the Treasure Hunt sample needs the audio, common, and core libraries.

Create new modules for each of these libraries. Using Android Studio's GUI, this can be done via File -> New -> New Module.... Select Import .JAR/.AAR Package. Locate one of the .AARs and import it.

Then add this new module as a dependency to your main app via File -> Project Structure -> Modules (on the left side's section list) -> YOUR APP's MODULE NAME -> Dependencies (on the right side's tab list) -> '+' -> Module Dependency.