일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 인턴 #프론트엔드 #개발자 #프론트엔드개발자 #취준
- flutter #깃
- flutter #git
- 유데미 #udemy #웅진씽크빅 #스나이퍼팩토리 #인사이드아웃 #미래내일일경험 #프로젝트캠프 #부트캠프 #react #리액트프로젝트 #프론트엔드개발자양성과정 #개발자교육과
- flutter #플러터
- #유데미 #udemy #웅진씽크빅 #스나이퍼팩토리 #인사이드아웃 #미래내일일경험 #프로젝트캠프 #부트캠프 #react #리액트프로젝트 #프론트엔드개발자양성과정 #개발자교육과정
- baekjoon #boj #c++
- boj #baekjoon
- flutter #플러터 #분석
- 백준 #boj
- flutter #todolist
- git #unity #깃허브
- 백준 #c++
- firebase #파이어베이스
- 비주얼스튜디오 #코드스니펫
- boj #baekjoon #c++
- flutter #firebase #플러터 #파이어베이스 #연동
- boj #c++
- flutter #app #취준
- 백준
- VS #비주얼스튜디오
- 비주얼 스튜디오 #vs #visual studio
- 플러터 #flutter #restful #rest api
- Flutter
- 로컬저장소 #이름변경
- unity #2d-game #minigame #vscode
- 백준 #boj #baekjoon
- baekjoon #백준 #boj
- unity #2d-game
- flutter #상태관리
- Today
- Total
cococo-coding
[Flutter] firebase와 연동하기(윈도우ver) 본문
정말 다사다난했던 firebase 연동기..
트러블슈팅 한 과정을 기록하기 위해 써보는 글이다.
설치 단계
설치하는 순서는 다음과 같다.
파이어베이스 홈페이지에 나와있는 내용이다.
1. firebase-tools-instant-win.exe 열어주기
그러면 다음과 같은 창이 나온다.
2. 파이어베이스 로그인 및 리스트 확인하기
나의 경우 이미 로그인이 되어있다고 뜨는데, 만약 안 되어 있다면 로그인 명령어와 파이어베이스 리스트를 보여주는 명령어로 확인을 한번 해준다.
3. 환경변수 설정하기
어쩌면 가장 메인파트... 솔직히 어려운건 아닌데 제대로 어떻게하라는 방법이 없어서 서치하는데 시간이 오래걸림
> dart pub global activate flutterfire_cli
위 명령어를 입력하는데 계속해서 다음 오류가 발생.
Warning: Pub installs executables into C:\Users\사용자이름\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
A web search for "configure windows path" will show you how.
Activated fltterfire_cli 0.2.7.
구글링 해봤는데 거의 다 macOS 해결만 나와서 계속 고전하다가 맨 아래 블로그글을 보고 겨우 해결했다.
해결법
환경 변수 설정 (새 사용자 변수 등록 -> 새 환경 변수 등록)
4. flutterfire-cli 명령어
> dart pub global deactivate flutterfire_cli
> dart pub global activate flutterfire_cli
위의 명령어를 차례로 입력해준다. 그러면 다음과 같이 flutterfire_cli를 deactivated했다가 actived됨을 확인할 수 있다.
5. 플러터 프로젝트의 터미널 열어서 firebase_core 명령어
지금까지는 파이어베이스 터미널로 했는데 여기서부터는 해당 플러터 프로젝트의 터미널에서 진행해야 한다!!!
이때 다음과 같은 오류가 날 수 있음
Building with plugins requires symlink support. Please enable Developer Mode in your system settings. Run start ms-settings:developers to open settings.
윈도우의 경우 설정에서 개발자모드를 켜주면 해결된다.
* 해당 오류에 관한 참조
https://stackoverflow.com/questions/68089177/flutter-building-with-plugins-requires-symlink-support
6. main파일에 firebase 인포트 및 코드 추가
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart'; //추가
import 'firebase_options.dart'; //추가
//main() 코드가 아래처럼 되도록 추가
void main() async{
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(const MyApp());
}
이렇게 하면 flutter프로젝트에 firebase연동이 끝난다.
중간의 CLI 부분에서 계속 환경변수 설정 에러가 났는데 공식 홈페이지에서는 해당 설명이 없어서 구글링을 통해 해결했다.
https://luvris2.tistory.com/839
전체적으로 설명도 잘 되어있고, 특히 내가 골머리를 앓았던 CLI부분의 환경변수설정이 상세히 설명되어있다. 강추!!!!!