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