How to create an Android Instant App?

If possible, please consider adding a feature to allow creation of Android Instant Apps. Thanks.

==

2 Likes

I think this is possible already through some changes to the Android manifest.

Could you please show us a simple, complete, working example of an Android instant app, especially what needs to be done in the manifest? Thanks a lot.

Not at the moment I’m afraid. I said that I think it can be done, but I haven’t actually tried. I’ll make a note of it and get back to testing it when I have worked through a couple of other things I need to do first.

7 Likes

===

Hi Britzl,

Unsure if you’ve finished a couple of other things you needed to do first. If you did, could you please show us

a complete, simple, working example of building an Android Instant App from Defold, especially what needs to be done in the AndroidManifest. Thanks a lot!

Try to edit your app manfiest based on this document

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

2 Likes

Have you tried yourself? Less than 10mb app, with limited permissions and some changes to the Android manifest. It is all documented by Google, like in the link @Pkeod shared.

Reference A:
https://developer.android.com/topic/google-play-instant/getting-started/instant-enabled-app-bundle

In Reference A:
Edit your app’s manifest and build configuration
In this new instant directory, create a new manifest file called AndroidManifest.xml. In this file, declare the module as instant, and set the targetSandboxVersion to 2, which is required for the instant app experience to run:

instant/AndroidManifest.xml

<manifest
xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:dist=“http://schemas.android.com/apk/distribution”
android:targetSandboxVersion=“2”>
<dist:module dist:instant=“true” />
</manifest>


I put below in my AndroidManifest.xml,

&lt;manifest

xmlns:android="http://schemas.android.com/apk/res/android"

        package="com.puipui.volcanoesinstant"

    android:versionCode="12"

    android:versionName="1.11"

xmlns:dist="http://schemas.android.com/apk/distribution"

android:targetSandboxVersion="2"&gt;

&lt;dist:module dist:instant="true" /&gt;

</manifest>


In Defold Editor 2, Linux 64, Project/Bundle/Android Application:

After a while, below Build Errors appeared:

…AndroidManifest.xml:12:error:Error Parsing XML:junk after document element

What’s wrong? Thanks

Can you post your complete edited Androidmanfiest.xml? You can zip it to upload.

Are you editing the one from the builtins/manifests/android ?

1 Like

Hi, According to my understanding from Google information. One must publish an app/game < 10 mb first, then make it an Instant one.

So, I already published one app and the AndroidManifest.xml was edit from the one in armv7-android without any Instant reference. In Defold Editor 2, Linux 64, Project/Bundle/Android Application worked fine, and below new app was published

Google Play Console
Release Management/App Releases
https://play.google.com/store/apps/details?id=com.puipui.volcanoesinstant

My understanding, now to make the app instant, one must edit the AndroidManifest.xml and submit a new APK to
Google Play Console/Release Management/Android Instant Apps. The AndroidManifest.xml (attached) had error from Defold Editor 2, Linux 64, Project/Bundle/Android Application.

Please help. Thanks.AndroidManifest.zip (1.4 KB)

You don’t need to edit the one actually inside of the apk. You should edit the version in the builtins folder, and then define it in your game.project file.

I do not see any AndroidManifest.xml in the builtins folder.
Maybe the problem is Editor 2 does not understand
" android:targetSandboxVersion=“2”>
<dist:module dist:instant=“true” />"
as it’s new to Editor 2?

0%20-%20VectorPort

1 Like

We have different folder structures. But, that’s not the issue as I do not have trouble making a standard (non-instant) Android app using Editor 2.
The problem only started when I edited the AndroidManifest.xml to add the “instant” related stuff. I am stuck. Could you please try to make a simple Android Instant app using Editor 2? Thanks.

Is your editor version up to date? This file should be in your builtins folder!

I used version of manfiest from the builtins folder, and modified how it should be. It is a very minor change to make it work.

AndroidManifest.zip (1.6 KB)

But when uploading to Google Play for testing I get

ERROR: NO_SIG_FOR_TARGET_SANDBOX_VERSION: Missing APK Signature Scheme v2 signature required for target sandbox version 2

I think Defold doesn’t use Scheme v2 / doesn’t have an option for it maybe? So I will try to resign with another tool and upload again soon.

Thanks for trying to build a simple Android Instant app and sharing your info.

I’m using Defold Editor 2 version: 1.2.129.
Do I need to download the entire Editor 2 again?
Thanks.

You can try to redownload again. This is latest

2018-10-23%2020_58_16-About

I’m downloading Android Studio fresh right now so it will be a while before I progress on this computer.

@britzl Any idea about this? “ERROR: NO_SIG_FOR_TARGET_SANDBOX_VERSION: Missing APK Signature Scheme v2 signature required for target sandbox version 2” I tried making a new keystore but it didn’t help. Using this appmanifest in a blank “mobile template” project https://forum.defold.com/uploads/default/original/2X/1/169cd40824c68931c8e8b267e1c8935e80c7d97b.zip

Hi, correct me if I’m wrong. According to below info, two sections in the AndroidManifest need to be edited. In addition, version code for the “standard” APK must be higher than its “instant” APK’s.

https://developer.android.com/topic/google-play-instant/getting-started/instant-enabled-app-bundle
<manifest
xmlns:android=“http://schemas.android.com/apk/res/android”
xmlns:dist=“http://schemas.android.com/apk/distribution”
android:targetSandboxVersion=“2”>
<dist:module dist:instant=“true” />
</manifest>

https://developer.android.com/topic/google-play-instant/getting-started/game-instant-app
<activity android:name=".GameActivity">
<intent-filter>
<action android:name=“android.intent.action.MAIN” />
<category android:name=“android.intent.category.LAUNCHER” />
</intent-filter>
</activity>

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.