How to create an Android Instant App?

Seems to be this: https://source.android.com/security/apksigning/v2

Which seems to indicate that some additional signing step is required somehow and that isn’t being made by our build pipeline? (<- me guessing)

Maybe @Mathias_Westerdahl knows more?

This already exists in the vanilla manifest. The important parts are the intent filter, otherwise their thing is just the example. At least if I’m not mistaken.

        <activity android:name="com.dynamo.android.DefoldActivity"
                android:label="{{project.title}}"
                android:configChanges="orientation|screenSize|keyboardHidden"
                android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                android:screenOrientation="{{orientation-support}}"
                android:launchMode="singleTask">
            <meta-data android:name="android.app.lib_name"
                    android:value="{{exe-name}}" />
            {{#android.push_field_title}}
            <meta-data
                android:name="com.defold.push.field_title"
                android:value="{{android.push_field_title}}" />
            {{/android.push_field_title}}
            {{#android.push_field_text}}
            <meta-data
                android:name="com.defold.push.field_text"
                android:value="{{android.push_field_text}}" />
            {{/android.push_field_text}}
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

I’m curious, is there any particular reason why you are 10 versions behind in the editor? (Knowing these things helps us with the development)

I have tried many versions myself before coming to Defold for help.
In addition, Google said the “standard(non-instant)” version code of the same app must have a higher number than its “instant” counter part. In this case, I set the version code to be 20 for (non-instant) and 10 for instant.

Please see
https://developer.android.com/topic/google-play-instant/getting-started/game-instant-app

Version codes

The version code of your game’s instant app needs to be less than the version code of the installable game. The expectation is that players move from the Google Play Instant experience to downloading and installing the game onto their device. The Android framework considers this transition to be an app update.
To make sure that you follow this versioning scheme, you can use one of these strategies:

  • Restart the version codes for the Google Play Instant experience at 1.
  • Increase the version code of the installable APK by a large number, such as 1000, to ensure that there is enough space for your instant app’s version number to increase.
    Note: The version code isn’t a user-facing value and is primarily used by the system. The user-facing version name has no restrictions.

You’re not wrong about this detail, I believe the reason is so the full version can simply replace the stripped down Instant version, and the full version requires a higher version code to be able to do that.

@Mathias_Westerdahl was talking about the Defold Editor version number though. The editor should automatically prompt you to update.

Well, it’s the first time I hear about it. Seems pretty new, and I’m guessing we need to update our signing tool in bob. Will make a ticket for that.

4 Likes

Managed to get test Android Instant Games enabled APK to sign and upload. I created a new .keystore with KeyStore Explorer and then signed with this tool

As this tool uses Google’s apksigner in the background, it will automatically sign it with the most recent signing schema depening on your min and targetSdk - there is nothing to config. In fact you can check in the log which signing schema will be used

Made a batch file for signing

java -jar uber-apk-signer.jar --apks ./apks --out ./apks/out --ks keystore.keystore --ksAlias "test" --ksKeyPass 12345 --ksPass 12345
PAUSE

Folder looks like this

2018-10-25%2021_46_43-Window

3 Likes

If my understanding is correct, Google requires a standard (non-instant) APK be made first with a higher version code.
So, to make this non-instant APK first, in Defold Editor 2, Project/Bundle/Android Application:
what (Certificate) and (Private key) should be used in relation to the new info you just provided? Thanks.

Doesn’t matter, you are going to have to resign with a new .keystore anyway.

Also you should be letting Google manage release signing. Use the .keystore you are making only for uploading to Google play.

When creating a new keystore using Keystore Explorer, must I select “UBER” as the type?

Follow this guide https://headjack.io/tutorial/create-android-keystore-file/

1 Like