将BaseGameUtils添加到Android Studio

时间:2014-09-09 14:30:20

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

我正在尝试将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 \库\ BaseGameUtils

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

当我尝试将我的课程扩展到BaseGameActivity时,它表示无法解析符号。

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

1 个答案:

答案 0 :(得分:1)

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

dependencies {

    // dependencies...

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

}