0

What I want to achieve

A android project which consists of a normal app and a instant app version of it which will be a demo version of the normal app.

The problem

On a fresh emulator/device I can run the app without any problem. I also can run the instant app after deinstalling the normal app without any problem. But I cant install the normal app after running the instant app once on the device. The only thing that helps is wiping the data on the emulator.

This is the error I receive:

08/10 17:25:12: Launching 'app' on Pixel 3a API 27.
Installation did not succeed.
The application could not be installed.

List of apks:
[0] '/<path-to-project/instant/app/build/outputs/apk/debug/app-debug.apk'
Installation failed due to: '-27'
Retry

What I have so far

Based on the google samples here InstantApps Google samples I created a new project and added a Instant dynamic feature module. So my project has the following structure:

-app/manifest/AndroidManifest.xml
-app/<packagname>/MainActivity
-instant/manifest/AndroidManifest.xml
-instant/<packagname>/InstantActivity

Snippet of the instant/manifest/AndroidManifest.xml:

<dist:module
    dist:instant="true"
    dist:title="@string/title_instant">
    <dist:delivery>
        <dist:install-time />
    </dist:delivery>

    <dist:fusing dist:include="false" />
</dist:module>

<application android:allowBackup="false">
    <activity android:name=".InstantActivity">
        <intent-filter
            android:autoVerify="true"
            android:order="2">
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.BROWSABLE" />
            <category android:name="android.intent.category.DEFAULT" />

            <data android:host="com.farmdok.multi.instant" />
            <data android:pathPrefix="/instant" />
            <data android:scheme="https" />
            <data android:scheme="http" />
        </intent-filter>
    </activity>
</application>

The full code of that new project is here on my github: InstantAppTest

This is how i run the normal app:

enter image description here

This is how i run the instant app: enter image description here

IIIIIIIIIIIIIIIIIIIIII
  • 3,958
  • 5
  • 45
  • 70

1 Answers1

0

I managed to find the problem by installing the app over adb with:

adb install -r -t --full <installed-app.apk>

This gave me a more detailed error message:

adb: failed to install app-debug.apk: Failure [-27: Package <packagename>.instantapp new target sandbox 1 is incompatible with the previous value of2.]

So all I needed was to add:

android:targetSandboxVersion="2"

to the Manifest of the app

IIIIIIIIIIIIIIIIIIIIII
  • 3,958
  • 5
  • 45
  • 70