我有一个.NET MAUI项目,其中包含大量资产(图像)的 Resources \ Images
目录,该目录应部署到Google Play商店。这意味着生成的AAB软件包的大小超出了Google Play商店限制的限制。
(消息:您的应用程序包包含以下配置,其中初始安装将超过150 MB
...)
我的当前解决方案将图像调整为< = 150MB。我现在看到有可能为资产生成单独的文件,这些文件称为 play功能交付。
来自这个示例项目我获取以下gradle文件来创建一个安装- 时间包:
apply plugin: 'com.android.asset-pack'
assetPack {
packName = "install_time_asset_pack" // Directory name for the asset pack
dynamicDelivery {
deliveryType = "install-time" // delivery mode
}
}
我的问题是:是否可以通过.net Maui来完成此操作?是否可以在CSPROJ文件中添加一些元素来执行此操作,例如对于密钥库:
<PropertyGroup Condition="$(TargetFramework.Contains('-android')) and '$(Configuration)' == 'Release'">
<AndroidKeyStore>True</AndroidKeyStore>
<AndroidSigningKeyStore>..\myapp.keystore</AndroidSigningKeyStore>
<AndroidSigningKeyAlias>key</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>SuperSecretPassword!</AndroidSigningKeyPass>
<AndroidSigningStorePass></AndroidSigningStorePass>
</PropertyGroup>
应用程序和用户的特征使得无法在运行时加载图像,例如通过HTTPS加载图像。
I have a .NET MAUI Project with a lot of assets (images) in the Resources\Images
directory that shall be deployed to the Google Play Store. This means that the size of the generated aab package is way beyond the Google Play Store limit of 150MB.
(Message: Your App Bundle contains the following configurations where the initial install would exceed the maximum size of 150 MB
...)
My current solution resizes the images to <= 150MB. I now saw that there is the possibility to generate separate files for the assets, which is called Play Feature Delivery.
From this sample project I get the following gradle file to create an install-time-package:
apply plugin: 'com.android.asset-pack'
assetPack {
packName = "install_time_asset_pack" // Directory name for the asset pack
dynamicDelivery {
deliveryType = "install-time" // delivery mode
}
}
My question is: Can this somehow be done with .NET MAUI? Is it possible to add some elements to the csproj-file to do this, just like for example for the keystore:
<PropertyGroup Condition="$(TargetFramework.Contains('-android')) and '$(Configuration)' == 'Release'">
<AndroidKeyStore>True</AndroidKeyStore>
<AndroidSigningKeyStore>..\myapp.keystore</AndroidSigningKeyStore>
<AndroidSigningKeyAlias>key</AndroidSigningKeyAlias>
<AndroidSigningKeyPass>SuperSecretPassword!</AndroidSigningKeyPass>
<AndroidSigningStorePass></AndroidSigningStorePass>
</PropertyGroup>
The characteristic of the app and the users makes it impossible to load the images at runtime, e.g. via https.
发布评论
评论(2)
tl; dr 我目前没有找到任何毛伊岛的答案。
最好的起点看起来像Xamarincomponent/android/googleandroidvending。
但是,这包含一个Java库,并且似乎使用了Gradle,因此TBD可以构建它需要什么知识,然后为毛伊岛进行调整。
相应的
xamarin.forms
doc是 apk扩展文件。xamarin.forms
nuget源代码和doc at 。那里有一个nuget链接,但是在
.net maui
中无法使用。直到有毛伊族人Nuget之前,有必要下载源代码并修改它。 做,可以上传返回github。tbd。
(如果有人这样
此外,可能会引用
Xamarin
命名空间,该空间应更改为MAUI
等效物。重要的是:此C#代码是Google的Java库的包装器。该项目包括
gradle
参考。 tbd建立此内容的要求是什么。tl;dr I did not find any Maui answer at this time.
The best starting point looks like XamarinComponent/Android/GoogleAndroidVending.
HOWEVER that wraps a java library, and appears to use gradle, so TBD what knowledge is required to be able to build this, then adapt it for Maui.
The corresponding
Xamarin.Forms
doc is APK Expansion Files.The
Xamarin.Forms
nuget source code and doc is at github XamarinComponents/Android/GoogleAndroidVending.There is a Nuget link there, but that won't work in
.Net Maui
.Until there is a Maui Nuget, it will be necessary to download the source code, and modify it. (If anyone does this, would be good to upload back to github. TBD where.)
App Startup is a bit different in
.Net Maui
, I did not investigate what might need to change.In addition, there might be references to
Xamarin
namespaces that should change toMaui
equivalents.IMPORTANT: This c# code is a wrapper for a java library from Google. The project includes
gradle
references. TBD what the requirements are to build this.如果您的APK超过150MB,那么我怀疑Google和Apple(如果您正在制作iOS应用程序)会希望您在云中托管图像数据,并根据需要将其拉到设备上,以便您“不堵塞用户”设备不必要地存储。该类型的静态图像应存储在缓存中,而不是备份(因此您需要检查它是否存在并在必要时重新下载)。
If your APK is getting over 150Mb then I suspect Google and Apple (if you're making an iOS app) will be expecting you to host the image data in the cloud and pull it to the device on an 'as needed' basis so you're not clogging your users' device storage up unnecessarily. That type of static imagery should be stored in cache and not backed up (so you'll need to check if it exists and re-download if necessary).