Search code examples
androidandroid-studiogradleandroid-gradle-pluginandroid-instant-apps

Android Studio 4.1.1 “Run” not compiling code


My problem is similar to below que Android Studio 3.1 "Run" not compiling code But I do not see any option to add Instant app provision as mentioned there.

Here is a screenshot of it. Can anyone help me where to find it.

Screenshot showing there is no add option for Instant app provision enter image description here


Solution

  • You need to Enable instant app support for that. In the toolbar menu of Android studio, go to Refactor -> Select Enable Instant Apps Support option -> select the desired module and click OK. This will add the below line in Manifest file:

    <dist:module dist:instant="true" />

    Once done, edit Run configurations and there you will find checkbox of Deploy as Instant app in Installation options section, enable it, and then run the app on the device, you will find the Instant app running on your device.

    Note: Please uninstall the previous version of app if any.

    For step by step guide, follow below reference before following above steps, there is also dependency that needs to be added.

    Reference:

    Google Instant App Guide