Build your first Generative AI app in Android Studio

Non-Poppin Jid
TakoDigital
Published in
3 min readMay 20, 2024

--

This guide will show you how to build an app with Generative AI using Android Studio and the Google AI SDK. It breaks down the process into three easy steps. Just make sure you’re using the latest preview version of Android Studio before you dive in!

Let’s Start!!!

Step 1: Build on the New Project template for AI

Start Android Studio and open a new project using File > New Project. Select the new Gemini API starter template.

Step 2: Generate the API key

In the next step, you’ll pick a catchy name and location for your project. Then, the wizard will ask for an API key to unlock the power of Gemini. Don’t worry if you don’t have one yet! The wizard will kindly provide a link to Google AI Studio where you can request a new key in a snap. Once you have your key, just copy it back into the wizard and click “Finish” to get rolling!

Step 3: Start prototyping

Android Studio will take care of all the technical stuff, connecting your project to the Gemini magic! Just click “Run” to see your code come to life in the Android Emulator. The app comes with a pre-written message asking the model to summarize some text for you. Feel free to edit or add more details to this message directly in the code to control what the model does. If you want to dive deeper into crafting powerful prompts, check out the Google AI Studio documentation for some handy tips!

Try to PROMPT!!!

Reference :

--

--

Non-Poppin Jid
TakoDigital

Android & IOS Developer at MACO , Member DManiac MegaCrew Thailand — >>arnon010@hotmail.com