android - 将 BaseGameUtils 添加到 Android Studio

标签 android android-studio google-play-services

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

到目前为止我做了什么:

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

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

然后在 list 中

   <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"/>

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

AndroidStudioProjects\ColorMatch\libraries\BaseGameUtils

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

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

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

最佳答案

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

dependencies {

    // dependencies...

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

}

关于android - 将 BaseGameUtils 添加到 Android Studio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25747264/

相关文章:

android - 找不到 com.google.android.gms :play-services:7. 0.0

android - Android-错误:任务 ':app:transformClassesWithDexForRelease'的执行失败

java - 单击 3 次后删除 ListView 项目

java - 如何从短信中过滤/提取代码 (Android)

java - 未经检查地调用 setClass(Class<T>) 作为原始类型的成员

android - 在另一台计算机上运行 Android 模拟器

android-studio - Android Studio 包没有正确嵌套

android - 如何在android中存储API凭据并避免反编译攻击?

android - 将 GooglePlayServicesInterstitial 添加到 MoPub SDK

java - 如何在 Android 父 fragment 中 findViewById() (获取 ClassCastException)?