[英]Google Play game services - Android samples errors
Based on Android docs ( https://developers.google.com/games/services/android/quickstart#before_you_begin ) for learning how to configure Google Play game APIs onto a sample app such as TypeANumber, I was wondering why I get the following resource errors from the BaseGameUtils library after importing the project, BasicSamples, from their GitHub's ( https://github.com/playgameservices/android-basic-samples ) source files:基于 Android 文档( https://developers.google.com/games/services/android/quickstart#before_you_begin ),用于学习如何将 Google Play 游戏 API 配置到示例应用程序(例如 TypeANumber)上,我想知道为什么会得到以下信息从 GitHub 的 ( https://github.com/playgameservices/android-basic-samples ) 源文件导入项目 BasicSamples 后,BaseGameUtils 库中的资源错误:
... Based on the directory in the left panel, did I import it properly? ...基于左侧面板中的目录,我是否正确导入了它? All I did was import it straight from the directory: android-basic-samples/BasicSamples/build.gradle as stated in Step 1 of the link.
我所做的只是直接从目录中导入它:android-basic-samples/BasicSamples/build.gradle,如链接的第 1 步所述。
Here's my (untouched) Gradle file for the library, BaseGameUtils:这是库 BaseGameUtils 的(未触及的)Gradle 文件:
apply plugin: 'com.android.library'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
dependencies {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('appcompat_library_version')) {
ext.appcompat_library_version = '20.0.+'
}
if (!project.hasProperty('support_library_version')) {
ext.support_library_version = '20.0.+'
}
if (!project.hasProperty('gms_library_version')) {
ext.gms_library_version = '8.1.0'
}
compile "com.android.support:appcompat-v7:${appcompat_library_version}"
compile "com.android.support:support-v4:${support_library_version}"
compile "com.google.android.gms:play-services-games:${gms_library_version}"
compile "com.google.android.gms:play-services-plus:${gms_library_version}"
}
android {
// Set defaults so that BaseGameUtils can be used outside of BasicSamples
if (!project.hasProperty('android_compile_version')) {
ext.android_compile_version = 23
}
if (!project.hasProperty('android_version')) {
ext.android_version = '23'
}
compileSdkVersion android_compile_version
buildToolsVersion android_version
}
... Did anyone else experience this issue before? ... 之前有没有其他人遇到过这个问题?
EDIT AS OF 4/7, 3:37PM:编辑截至 4 月 7 日下午 3 点 37 分:
So I ended up importing the project again, but within the AndroidStudioProjects directory this time (does that really make a difference?) and I actually ended up making some progress since then.所以我最终再次导入了该项目,但这次是在 AndroidStudioProjects 目录中(这真的有什么不同吗?)并且从那时起我实际上取得了一些进展。 However, for part 3 under step 1 within the docs:
但是,对于文档中第 1 步下的第 3 部分:
... I ended up changing not only the package name in TypeANumber's manifest file, but also the package directory along with the classes in it as follows: ...我最终不仅更改了 TypeANumber 清单文件中的包名称,还更改了包目录及其中的类,如下所示:
... So my question now is, am I on the right track so far in terms of the navigation directory panel at the left? ... 所以我现在的问题是,到目前为止,就左侧的导航目录面板而言,我是否走在正确的轨道上? :)
:)
Yes.是的。 The package attribute in the manifest should always match the directories.
清单中的包属性应始终与目录匹配。 Plain and simple.
干净利落。 That's why changing it would require you to do a complete refactor.
这就是为什么改变它需要你做一个完整的重构。 Just keep on going with the tutorial accordingly and I think you'll be good.
继续相应地学习教程,我认为你会很好。 Good luck.
祝你好运。 :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.