App/Android
[Firebase] 연동 계정 변경
yonikim
2021. 8. 28. 16:48
728x90
Android Studio 와 Firebase 계정 연동을 위해서는 google-services.json 을 프로젝트의 app 디렉토리에 복사해야 한다.
프로젝트를 바꾸며 새로운 google-services.json 을 다운 받아 교체했는데, 아래와 같은 에러가 발생하며 과거의 잔해 계정이 나를 괴롭혔다.
Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: Database lives in a different region. Please change your database URL to
https://${project}.asia-southeast1.firebasedatabase.app
원인은 프로젝트 내에 자동 생성된 구글 서비스 리소스 중 나의 과거 계정과 관련된 파일들이 변경되지 않았기 때문이었다.
$ rm ${Android Studio Project Path}/app/build/generated/res/google-services/debug/values/values.xml
$ rm ${Android Studio Project Path}/app/build/intermediates/incremental/mergeDebugResources/merger.xml
$ rm ${Android Studio Project Path}/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
위의 파일들을 찾아 삭제하고, 다시 google-service.json 파일을 업데이트 해주면 정상적으로 현재 계정과 연동되는 것을 확인할 수 있다.
(참고 : update google-services.json doesn't update the app - github issue)
728x90