【发布时间】:2013-05-13 13:17:06
【问题描述】:
我正在尝试使用新的 Android Studio 测试 Google Play 服务。 我有一个依赖于 google_play_services.jar 的项目。 但是当我尝试重建项目时,出现以下错误:
Information:[TstGP3-TstGP3] Crunching PNG Files in source dir: C:\Users\ans\AndroidStudioProjects\TstGP3\TstGP3\src\main\res
Information:[TstGP3-TstGP3] To destination dir: C:\Users\ans\AndroidStudioProjects\TstGP3\build\classes\res-cache\TstGP3-TstGP3
Information:Compilation completed with 2 errors and 0 warnings in 2 sec
Information:2 errors
Information:0 warnings
C:\Users\ans\.AndroidStudioPreview\system\compiler\tstgp3.3f17bd41\.generated\Android_BuildConfig_Generator\TstGP3-TstGP3.74fc5b25\production\com\example\tstgp3\BuildConfig.java
Error:Error:line (4)error: duplicate class: com.example.tstgp3.BuildConfig
C:\Users\ans\.AndroidStudioPreview\system\compiler\tstgp3.3f17bd41\.generated\aapt\TstGP3-TstGP3.74fc5b25\production\com\example\tstgp3\R.java
Error:Error:line (10)error: duplicate class: com.example.tstgp3.R
它似乎有两个 BuildConfig 文件和两个 R 类。我该如何解决这个问题?
编辑:
我注意到编译器编译了两个 R.java 文件:一个位于我的项目文件夹中,另一个位于文件夹 %USERPROFILE%.AndroidStudioPreview 所以,我试图在编译器设置中排除这个“预览”文件夹,现在它可以工作了。 此问题仅在我开始在我的项目中使用 Google Play 服务类之后才会出现。 如果有人能解释这个问题背后的原因,我将不胜感激。
【问题讨论】:
-
任何人都可以帮助这个 compile 'com.google.android.gms:play-services:6.5.87' 添加到 android studio 中的依赖项部分。我们也可以添加罐子,但上面的行做了什么,因为我们没有添加罐子。
标签: android google-play-services android-studio