【问题标题】:Adding BaseGameUtils to Android Studio将 BaseGameUtils 添加到 Android Studio
【发布时间】:2014-09-09 14:30:19
【问题描述】:

我正在尝试将 BaseGameUtils 库添加到我的应用中。

所以到目前为止我做了什么:

我首先通过从sdk管理器下载sdk添加了GooglePlayServices lib,并添加了依赖项

compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services:+'

然后在清单中

   <meta-data android:name="com.google.android.gms.games.APP_ID"
        android:value="@string/app_id" />
   <meta-data android:name="com.google.android.gms.version"
       android:value="@integer/google_play_services_version"/>

我在我的应用程序的根文件夹中创建了一个文件夹库,并将 BaseGameUtils 文件夹添加到其中;

AndroidStudioProjects\ColorMatch\libraries\BaseGameUtils

我打开了 settings.grandle 添加了这一行 include ':libraries:BaseGameUtils'

当我尝试将我的类扩展到 BaseGameActivity 时,它说无法解析符号。

我找不到任何解释清楚地添加 BaseGameUtils 的说明。有任何想法吗?

【问题讨论】:

  • 您是否在应用程序的模块中包含了 BaseGameUtils 的依赖项?
  • 是的,我做到了。编译项目('libraries:BaseGameUtils')@ScottBarta
  • 你的项目是否与 Gradle 文件同步成功?

标签: android android-studio google-play-services


【解决方案1】:

除了将项目添加到settings.gradle之外,还需要将BaseGameUtils项目声明为编译依赖:

dependencies {

    // dependencies...

    compile project(':libraries:BaseGameUtils') // note the leading ':'

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多