帶有Google Play服務的Android Studio - Android Studio with Google Play Services

問題:

I'm trying to test Google Play Services with the new Android Studio. 我正在嘗試使用新的Android Studio測試Google Play服務。 I have a project with a dependency to the google_play_services.jar. 我有一個與google_play_services.jar相關的項目。 But when I try to Rebuild the project I get the following errors: 但是當我嘗試重建項目時,我收到以下錯誤:

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

It seems that it has two BuildConfig files and also two R classes. 它似乎有兩個BuildConfig文件和兩個R類。 How can I resolve the issue? 我該如何解決這個問題?

EDIT: 編輯:

I have noticed that the compiler compiles two R.java files: the one that is in my project folder and another one that is located in the folder %USERPROFILE%.AndroidStudioPreview So, I tried to exclude this "Preview" folder in the compiler settings and now it's working. 我注意到編譯器編譯了兩個R.java文件:一個位於我的項目文件夾中,另一個位於文件夾%USERPROFILE%.AndroidStudioPreview所以,我試圖在編譯器設置中排除這個“Preview”文件夾現在它正在發揮作用。 This issue only occurs after I have started to use Google Play Services classes in my project. 只有在我的項目中開始使用Google Play服務類後,纔會出現此問題。 I will appreciate if someone can explain the reason behind this problem. 如果有人能解釋這個問題背後的原因,我將不勝感激。


解決方案:

參考: https://stackoom.com/en/question/17ksN
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章