Android Instant App not being installed correctly(Behaves like a normal app)

孤街浪徒 提交于 2019-12-04 01:54:49

问题


I am trying to launch an instant app to the mobile using the following steps:

  1. Generate signed apk of Instant App in Android Studio, which would produce a zip file containing Base apk file and feature apk files.
  2. Unzip the generated file.
  3. Use command adb install-multiple -r -t *.apk to install the app. I was told to use adb install-multiple -r -t --instantapp *.apk but --instantapp tag would give me a following error: Exception occurred while dumping: java.lang.IllegalArgumentException: Unknown option --instantapp

So after doing this, I would expect instant app to be installed in my mobile device. Interestingly, Instant App is launchable, however it creates a normal app icon as if it is not an instant app. If I go Setting -> google -> Instant Apps, list of installed instant app is empty.

Also, the behaviour of Instant App installed this way is different from the Instant App installed directly using Run in Android Studio.

The devices I used are Google Pixel(8.0.0) and Nexus 5X(7.1.1).

Thanks for your help.


回答1:


A much easier way to do this is using the instant apps CLI present in the Instant Apps SDK versions 1.2 and above. Download the SDK using the SDK manager (either in Android Studio or from the command line version) and add extras/google/instantapps/ia (inside your SDK folder) to your PATH.

Then you can do ia run <something.zip> to launch instant apps on any supported device from the command line. Note that if you're using an emulator, make sure the version of Google Play services on the device is up to date (you can update it from the emulator's control panel).




回答2:


The command you were looking for with the install-multiple command is install-multiple -r -t --ephemeral *.apk




回答3:


I have these in my manifest and it works fine.

<manifest ... 
xmlns:dist="http://schemas.android.com/apk/distribution"
android:targetSandboxVersion="2">


来源:https://stackoverflow.com/questions/50847975/android-instant-app-not-being-installed-correctlybehaves-like-a-normal-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!