具有不同最低SDK水平的Instant App Installable App [英] Instant App Installable App with Different Min Sdk Levels
问题描述
我的android项目的最低sdk级别为16.我想将其转换为即时应用程序,但我需要保持最低sdk级别,但即时应用程序支持最低23.我试图在的可安装和即时应用程序中设置不同的api级别相同的项目并尝试覆盖它们,但我却做不到.那么,有什么方法可以在具有最低sdk最低级别的可安装应用程序和即时应用程序的同一个项目中工作?
my android project min sdk level is 16. I want to turn it into instant app but I need to maintain min sdk level but instant app supports min 23. I tried to set different api levels for the installable and instant app in the same project and tried to override them but I wasn't able to do. So is there any way to work in same project with installable app and instant app with different min sdk levels?
推荐答案
另一种方式来使即时应用APK具有所需的 minSdkVersion
与此:
Another way to do this so that the instant app APKs have the desired minSdkVersion
is with this:
应用(com.android.instant.application)清单:
<uses-sdk tools:overrideLibrary="com.example.feature"/>
应用程序(com.android.instant.application) gradle
:
App (com.android.instant.application) gradle
:
minSdkVersion rootProject.minSdk
功能(com.android.instant.feature) gradle
:
Feature (com.android.instant.feature) gradle
:
minSdkVersion rootProject.minSdkInstant
这使我能够构建
- 已安装应用程序和
minSdk
- 即时应用带有
minSdkInstant
的APK
- Installed app with
minSdk
- Instant app APKs with
minSdkInstant
唯一推荐的方法是使用风味.
The only recommended way is to use flavors.
除了 tools:overrideLibrary
方法之外,没有其他方法可以做到这一点.
Besides the tools:overrideLibrary
method, there are no other ways to do this.
APK是由 功能插件 生成的,而不是由 即时应用插件 生成的.
The APKs are generated from the feature plugin and not from the instant App plugin.
您可以检查 > android-instant-apps/configuration-apks/features/build.gradle 以及 SO问题
这篇关于具有不同最低SDK水平的Instant App Installable App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!