[Android] 안드로이드 스튜디오 Iguana 베타 설치 & Gemini API로 생성형 AI앱 빌드하기
Android용 Google AI 클라이언트 SDK를 사용하여 Android 앱에서 직접 Gemini API에 액세스하는 방법
Jan 18, 2024
- 현재 버전이 Hedgehog이라면 Android Studio Preview에 들어가서 이구아나 설치를 눌러줍니다! 혹시나 맥 쓰는데 이 화면이 안보인다면 사이트 언어를 영어로 바꾸고 다시 링크 들어가보세요!

- 원하는 경로에 저장해놓고 압축을 풀어줍니다!



그러면 기존 안드로이드 스튜디오 앱 옆에 안드로이드 스튜디오 프리뷰 앱이 보입니다!
Import android studio settings? 라고 알림이 뜰텐데, 기존 안드로이드 스튜디오 앱을 선택해서 셋팅을 가져옵니다.
- Android 스튜디오에서 첫 번째 생성형 AI 앱 빌드하기 에 들어가서 순서대로 따라합니다.
- 근데 위 화면이 보여야 하는데 아래 화면이 나온다면?
- 구글링해봅시다… Why I have no Gemini API starter template in my Android Studio?



이구아나 베타 버전이고, 대한민국은 지원되는 지역인데,,, 안뜬다…
- 왜 안뜨는지 모르겠다. 샘플앱을 가져와본다. File > New > Import Sample을 통해 Generative AI 코드 샘플을 Android Studio로 가져오고 Generative AI Sample을 검색해서 가져온다.


언제나 리드미를 잘 읽자. 특히 이런 공식 문서는 설명이 잘 되어있다!

여기서
Create API in new project
를 눌러서 API key를 발급받는다. 이 키는 절대 공유하면 안된다. 메모장에 잘 메모해두고, 프로젝트 local.properties
에 apikey=YOUR_API_KEY
를 입력한다. 그리고 gitignore
에 local.properties
를 추가해준다.그리고 앱을 빌드해주면 다음의 스크린샷처럼 텍스트요약, 채팅, 멀티모달 기능을 이용해 볼 수 있다.




Share article