Skip to content

Most visited

Recently visited

navigation

Create your first instant app

This page teaches you how to build and run a very simple instant app using Android Studio. The app that you create has a simple structure similar to the structure described in Structure of a basic instant app.

To create a new instant app project in Android Studio 3.0, do the following:

  1. Launch Android Studio and create a new project:
    • If you have not opened a project yet, in the Welcome to Android Studio window, click Start a new Android Studio project.
    • If you already have a project open, select File > New Project.
  2. In the Create Android Project window, do the following:
    • In the Application name box, enter "My First Instant App".
    • In the Company domain box, enter "example.com".
    • Leave the Package name as "com.example.myfirstinstantapp".
  3. Click Next.
  4. In the Target Android Devices window, do the following:
    • Ensure that Phone and Tablet is selected.
    • In the Minimum SDK list, select API 23: Android 6.0 (Marshmallow).
    • Under the Minimum SDK list, check Include Android Instant app support.

    Figure 1. The Target Android Devices window.

  5. Click Next.
  6. In the Customize Instant App Support window, leave the default settings.
  7. Click Next.
  8. In the Add an Activity to Phone and Tablet window, select Empty Activity.
  9. Click Next.
  10. In the Configure Activity window, do the following:
    • In the Instant App URL Host box, enter 'myfirstinstantapp.example.com'.
    • In the Instant App URL route box, enter '/hello'.

    Figure 2. The Configure Activity window.

  11. Click Finish.

After Android Studio has finished creating the project, you can run the instant app. Make sure that you have already created an emulator that can run instant apps, as described in Set up your device or emulator.

To run the project in Android Studio, do the following:

  1. Click the the instantapp module in the Project window and then select Run > Run 'instantapp'.
  2. In the Select Deployment Target window, select the emulator that you have set up for instant app development.

Android Studio builds and runs the app on the emulator as shown in figure 3.

Figure 3. 'My First Instant App' running.

Next Steps

For more information about the project structure of an instant app, see Project Structure.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)