我正在尝试使用新的 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 服务类之后才会出现。如果有人能解释这个问题背后的原因,我将不胜感激。