请帮助减少Xamarin.Android APK大小 [英] Please help reducing Xamarin.Android apk size

查看:60
本文介绍了请帮助减少Xamarin.Android APK大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Android应用程序,但是尺寸似乎很大!我启用了Pro Guard,启用了所有链接,但看上去似乎没什么作用.我有四个小图像,但每个图像的大小约为5-10kb.唯一较小的时间是在共享运行时中运行,但发布时还不行.这些是我唯一的构建警告:

I have been working on an Android app but size seems very large! I have pro guard enabled, link all enabled but dosent seem to do much. I have four small images but their size is around 5-10kb each. The only time it is smaller is when I run with shared runtime but that's not Ok for publishing. These are my only build warnings:

Warning     can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])    

Warning     can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [internal_impl-22.2.1.jar:META-INF/MANIFEST.MF])

这些警告与问题有关吗?

Do these warnings have anything to do with issue?

推荐答案

apk约为14MB,包括armeabi,amreabi-v7a,x86.关联设置为:"SDK和用户程序集"

The apk is about 14MB, including armeabi, amreabi-v7a, x86. Link setting is: 'Sdk and User Assemblies'

apk大小似乎没什么问题.

Nothing seems amiss with that apk size.

仅支持链接SDK和用户程序集的一种ARCH类型的"Hello World" Xamarin.Android应用大约需要4MB(对于ARCH类型的armeabi-v7a).

A "Hello World" Xamarin.Android app supporting just one ARCH type that is linking SDK and User assemblies would be around 4MB (for ARCH type armeabi-v7a).

每个附加的ARCH类型将添加另一组libmonodroid.so和libmonosgen-2.0.so ...请记住,在Android上运行的Mono是NDK应用程序,因此必须为每个包含本机代码> ARCH类型.APK的大小不是物理设备上实际安装的应用程序的大小,因为Android操作系统会在安装过程中从APK中剥离实际所需的本机库.

Each additional included ARCH type is going to add another set of libmonodroid.so and libmonosgen-2.0.so... Remember Mono running on Android is an NDK application and thus must include native code for each ARCH type. The APK size is NOT the size of the actual installed application on the physical device as the Android OS will strip the actual needed native libraries from the APK during the install.

因此,在包括三种拱门类型的情况下,您仅将9 + MB用于Mono/MonoDroid运行时:

So in your case of including three arch types, you are looking at 9+MB just for the Mono/MonoDroid runtime:

./armeabi:
   144912  libmonodroid.so
  2835260  libmonosgen-2.0.so

./armeabi-v7a:
   144916  libmonodroid.so
  2790212  libmonosgen-2.0.so

./x86:
   128436  libmonodroid.so
  3449836  libmonosgen-2.0.so

了解Xamarin.Android中APK的组成部分

这篇关于请帮助减少Xamarin.Android APK大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆